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

Bug: It's not possible to use formatNumber without options #83

Closed
ksocha opened this issue Oct 3, 2023 · 1 comment
Closed

Bug: It's not possible to use formatNumber without options #83

ksocha opened this issue Oct 3, 2023 · 1 comment

Comments

@ksocha
Copy link

ksocha commented Oct 3, 2023

As in the title, it is not possible to omit options argument of formatNumber.
There is an example in the readme indicating it should work:

i18n.t("points", {
  count: points,
  points: i18n.formatNumber(points),
});

However, this actually leads to following error:

formatNumber.js:17 Uncaught TypeError: Cannot read properties of undefined (reading 'raise')
    at formatNumber (formatNumber.js:17:1)
    at I18n.formatNumber (I18n.js:274:28)

Passing empty object as options results in NaN being returned.

What do you expect

As in the example, and similar to how to Intl allows, I would expect that it's possible to omit the options param:

Intl.NumberFormat().format(14.45435)

Software:

  • NPM package: v4.3.2
@fnando
Copy link
Owner

fnando commented Feb 10, 2024

Fixed by 8b2ca74

@fnando fnando closed this as completed Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants