Skip to content

decimalRangeFormatter
@localizer/format-number 1.1.1

The decimalRangeFormatter provides a flexible and customizable way to format numeric ranges. It is particularly useful for scenarios where you need to display a range of numbers with specific formatting options, such as compact notation or localized styles.

Usage

typescript
import { 
decimalRangeFormatter
} from '@localizer/format-number';
const
formatter
=
decimalRangeFormatter
({
notation
: 'compact',
compactDisplay
: 'long',
}); const
result
=
formatter
(1000, 2000);

See formatter options for configuration details.

Demo

compact
long
─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
LocaleLocalized value
en-US  American English1,000–2,000
fr-FR  French (France)1 000–2 000
de-DE  German (Germany)1.000–2.000
fi-FI  Finnish (Finland)1 000–2 000
sv-FI  Swedish (Finland)1 000‒2 000
ko-KR  Korean (South Korea)1,000~2,000
hi-IN  Hindi (India)1,000–2,000

See also