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
Locale | Localized value |
---|---|
en-US | +43% |
fr-FR | +43 % |
de-DE | +43 % |
fi-FI | +43 % |
sv-FI | +43 % |
ko-KR | +43% |
hi-IN | +43% |