Properties that can be passed into the constructor for utilities/format/number!NumberFormatter.

interface NumberFormatterProperties {
    currency?: string;
    defaultFormat?: string;
    defaultParseFormat?: string | string[];
    fractionalDigits?: number;
    locale?: string;
}

Hierarchy (view full)

Properties

currency?: string

The 3-letter ISO 4217 currency code (e.g "USD", "CAD"). Required when formatting a number using NumberFormat.CURRENCY or NumberFormat.ACCOUNTING.

defaultFormat?: string

The default format for formatting numbers. See utilities/format/number!NumberFormatter.format.

defaultParseFormat?: string | string[]

Either a single format, or one of several possible formats that the input is expected to be in. If specified, the input must exactly match. The syntax is the same as for utilities/format/number!NumberFormatter.format.

fractionalDigits?: number

The number of digits to show after the decimal point. If unspecified, an appropriate value is determined based on the locale and currency.

locale?: string

The locale to use when formatting & parsing the number. If not specified, the current locale is used (see locale module).