Skip to content

relativeDecimalFormatter
@localizer/format-number 1.1.1

This formatter calculates and formats the percentage change between two numeric values. It is particularly useful for representing relative growth, decline, or variation in a clear and customizable way.

Usage

typescript
import { 
relativePercentFormatter
} from '@localizer/format-number';
const
formatter
=
relativePercentFormatter
({
minimumFractionDigits
: 2,
maximumFractionDigits
: 2,
}); 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

─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
LocaleLocalized value
en-US  American English+43%
fr-FR  French (France)+43 %
de-DE  German (Germany)+43 %
fi-FI  Finnish (Finland)+43 %
sv-FI  Swedish (Finland)+43 %
ko-KR  Korean (South Korea)+43%
hi-IN  Hindi (India)+43%

See also