Formatting Data#

Formatting Currencies#

import { formatCurrency } from "@tinka/content";
formatCurrencyinput: numberoptions: formatCurrencyOptions
any number that you wish to format. The function does not convert cents. Passing 1 means 1 euro, dollar... etc.an optional object to customise the formatting.

The function rounds incoming values to the second decimal place. An input of 1.999 will have the same output of using 2 as the input.

FormatCurrencyOptions#

propertytypedescription
thousandsSeparatorstringThe string used as the thousands separator. It's , in the US and . in the Netherlands.
decimalSeparatorstringThe string used as the decimal separator. It's . in the US and , in the Netherlands.
currencySymbolstringThe string will prepend to the formatted value. Example: or EUR , not the space here.
roundFigureSymbolstringIn some countries, a dash is used when the fractional part of a value is zero. Pass an empty string to disable this substitution.
noCentsbooleanThe output will not have the fractional part of the formatted value. (Note: the built-in rounding still applies)

formatCurrencyPresets#

Presets can be imported by:

import { formatCurrencyPresets } from "@tinka/content";

Formatting Date#

We recommend using the package date-fns and use the nl locale for the Netherlands.