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

Use .toLocalString() to manage seperators and decimal points #17

Open
nfriedly opened this issue Apr 19, 2018 · 0 comments
Open

Use .toLocalString() to manage seperators and decimal points #17

nfriedly opened this issue Apr 19, 2018 · 0 comments

Comments

@nfriedly
Copy link
Owner

nfriedly commented Apr 19, 2018

This should at least be an option, and possibly the default behavior:

(12345.6).toLocaleString() // '12,345.6' in the US
(12345.6).toLocaleString('de-DE') // '12.345,6' in firefox, '12,345.6' in node.js :(
(12345.67).toLocaleString('en-US', {maximumFractionDigits: 1}) // '12,345.7'

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

Note that it doesn't work properly in node.js - the German example uses US formatting there :(

Also note that local seems to be required in order to pass in any options :(

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

1 participant