Skip to content

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

@nfriedly

Description

@nfriedly

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 :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions