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

Incorrect Implementation of Number.toLocaleString #285

Closed
omervk opened this issue Nov 23, 2017 · 1 comment · Fixed by #472
Closed

Incorrect Implementation of Number.toLocaleString #285

omervk opened this issue Nov 23, 2017 · 1 comment · Fixed by #472

Comments

@omervk
Copy link

omervk commented Nov 23, 2017

// Current locale is en-US
1451.toLocaleString()

Expected: 1,451
Actual: 1451

1451.toLocaleString('en-US')

Expected: 1,451
Actual: RangeError: toString() radix must be between 2 and 36

Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString

stevenh added a commit that referenced this issue Nov 29, 2022
Add support for Number.toLocaleString() which was previously just using
toString.

Fixes #285
stevenh added a commit that referenced this issue Nov 29, 2022
Add support for Number.toLocaleString() which was previously just using
toString.

Fixes #285
stevenh added a commit that referenced this issue Nov 29, 2022
Add support for Number.toLocaleString() which was previously just using
toString.

Default locale is: en-US

Fixes #285
stevenh added a commit that referenced this issue Nov 29, 2022
Add support for Number.toLocaleString() which was previously just using
toString.

Default locale is: en-US

Fixes #285
stevenh added a commit that referenced this issue Nov 29, 2022
Add support for Number.toLocaleString() which was previously just using
toString.

Default locale is: en-US

Fixes #285
@stevenh
Copy link
Collaborator

stevenh commented Nov 29, 2022

This would require Intl.

The two argument form is not supported in ES 5, hence the error you get.

With all that said number support is pretty trivial so I've implemented that in #472

sg3des pushed a commit to sg3des/otto that referenced this issue Jul 17, 2023
Add support for Number.toLocaleString() which was previously just using
toString.

Default locale is: en-US

Fixes robertkrimen#285
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

Successfully merging a pull request may close this issue.

2 participants