Skip to content

relativeDecimalFormatter
@localizer/format-number 1.1.1

A customizable formatter designed to represent absolute changes between two unitless numeric values.

Usage

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

Represents the change from an initial reference value (first argument) to an updated value (second argument).

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 English+1,500
fr-FR  French (France)+1 500
de-DE  German (Germany)+1.500
fi-FI  Finnish (Finland)+1 500
sv-FI  Swedish (Finland)+1 500
ko-KR  Korean (South Korea)+1,500
hi-IN  Hindi (India)+1,500

See also