NumberFormatOptions
Settings for the formatNumber
and parseNumber
functions.
For a runnable example, refer to the article on date and number formatting and parsing.
currency?
string
Defines the currency code of the currency that is used in the formatting. If not specified, the default currency for the locale is used.
currencyDisplay?
"symbol" | "code" | "name"
Specifies how to display the currency.
maximumFractionDigits?
number
Defines the maximum number of fraction digits that will be used.
The default value of the decimal formatting is the greater one between minimumFractionDigits
and 3
.
The default value of the currency formatting is the greater one between minimumFractionDigits
and the number of digits for the currency from the supplemental currencyData
.
If no information about the currency is provided, the default value of the currency formatting is the greater one between minimumFractionDigits
and 2
.
The default value of the percent formatting is the greater one between minimumFractionDigits
and 0
(zero).
minimumFractionDigits?
number
Defines the minimum number of fraction digits that will be used.
The default value of the decimal and percent formatting is 0
(zero).
The default value of the currency formatting is the number of digits for the currency from the supplemental currencyData
.
If no information about the currency is provided, the default value of the currency formatting is 2
.
minimumIntegerDigits?
number
Defines the minimum number of integer digits that will be used in the formatting.
style?
"decimal" | "currency" | "percent" | "scientific" | "accounting"
Specifies the format style.
useGrouping?
boolean
Specifies whether to use grouping separators.