Skip to content

NumberFormat.prototype.parse method #147

Closed

Description

Had anyone thought that it might be very useful to have a NumberFormat.prototype.parse which does the opposite of format?

It can be very useful to know how a certain formatted number can be parsed since in different locales different symbols (such as decimal marks) can have different meaning.

So for example:

new Intl.NumberFormat('ja-JP', { style: 'currency', currency: 'JPY' }).format(123456.789)
// '¥123,457'

new Intl.NumberFormat('ja-JP').parse('¥123,457')
// would return something like { currency: 'JPY', value: 123457 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions