Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intl.NumberFormat.prototype.formatRange() implementation differs from real browsers when using currencies #4521

Open
chrisvltn opened this issue Sep 10, 2024 · 0 comments

Comments

@chrisvltn
Copy link

Which package?

@formatjs/intl-numberformat

Describe the bug

When formatting currency ranges, the result differs from what browser returns and looks weird for people reading localized text.

To Reproduce

const nf = new Intl.NumberFormat('es', {
  style: 'currency',
  currency: 'EUR',
  maximumFractionDigits: 0,
});

console.log(nf.formatRange(10, 100)); // Chrome: 10-100 €. Polyfill: 10 €-100 €

Expected behavior

Display the range as 10-100 € and also respect the other options passed in Intl.NumberFormat.

Desktop (please complete the following information):

  • OS: maxOS
  • Browser: Chrome and Firefox
  • Version: Firefox 129.0.2 and Chrome 128.0.6613.120

Additional context

Intl.NumberFormat.formatRange specification: https://tc39.es/ecma402/#sec-intl.numberformat.prototype.formatrange

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants