Skip to content

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

─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
─── unset ───
LocaleLocalized value
en-US  American English10% – 20%
fr-FR  French (France)10–20 %
de-DE  German (Germany)10–20 %
fi-FI  Finnish (Finland)10–20 %
sv-FI  Swedish (Finland)10‒20 %
ko-KR  Korean (South Korea)10% ~ 20%
hi-IN  Hindi (India)10% – 20%

See also