percentRangeFormatter @localizer/format-number 1.1.1
This formatter is designed to handle percentage ratio ranges, allowing you to format a range of values as percentages with precision and flexibility. It takes unscaled ratio values (e.g., 0.1
for 10%
) and applies the specified formatting options to produce a readable percentage range.
Usage
typescript
import { percentRangeFormatter } from '@localizer/format-number';
const formatter = percentRangeFormatter({
minimumFractionDigits: 2,
maximumFractionDigits: 2,
});
const result = formatter(0.1, 0.2);
The argument passed to this formatter represents a ratio in its unscaled form, where a value of 1.0
corresponds to 100%
.
See formatter options for configuration details.
Demo
Locale | Localized value |
---|---|
en-US | 10% – 20% |
fr-FR | 10–20 % |
de-DE | 10–20 % |
fi-FI | 10–20 % |
sv-FI | 10‒20 % |
ko-KR | 10% ~ 20% |
hi-IN | 10% – 20% |