-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Open
Labels
i18n-apiIssues and PRs related to the i18n implementation.Issues and PRs related to the i18n implementation.
Description
Version
v19.3.0
Platform
Microsoft Windows NT 10.0.22621.0 x64
Subsystem
No response
What steps will reproduce the bug?
const percentFormatter = new Intl.NumberFormat("en-US", { style: "percent" });
console.log(percentFormatter.formatRange(0.5, 0.55));
console.log(percentFormatter.formatRange(0.5, 0.5));
How often does it reproduce? Is there a required condition?
all the time for all locales
What is the expected behavior?
50% – 55%
~50%
Similar to:
const numberFormatter = new Intl.NumberFormat("en-US");
console.log(numberFormatter.formatRange(50_000, 55_000)); // 50,000–55,000
console.log(numberFormatter.formatRange(50_000, 50_000)); // ~50,000
What do you see instead?
50% – 55%
~5,000%
Additional information
maximumFractionDigits
behavior:
> percentFormatter = new Intl.NumberFormat("en-US", { style: 'percent' });
NumberFormat [Intl.NumberFormat] {}
> percentFormatter.formatRange(0.1234, 0.1234)
~1,200%
> percentFormatter = new Intl.NumberFormat("en-US", { style: 'percent', maximumFractionDigits:10 });
NumberFormat [Intl.NumberFormat] {}
> percentFormatter.formatRange(0.1234, 0.1234)
~1,234%
Metadata
Metadata
Assignees
Labels
i18n-apiIssues and PRs related to the i18n implementation.Issues and PRs related to the i18n implementation.