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

formatNumber: only a number is accepted #84

Open
sergey-be opened this issue Oct 20, 2016 · 0 comments
Open

formatNumber: only a number is accepted #84

sergey-be opened this issue Oct 20, 2016 · 0 comments

Comments

@sergey-be
Copy link

formatNumber helper explicitly verifies the type of a value and throws an exception if it's other than number. But Internationalization API Specification doesn't put such a restriction and Intl.NumberFormat().format() function accepts the argument of any type. So the following examples are perfectly legitimate:

const format = new Intl.NumberFormat().format;
format('1234.56'); // ==> 1,234.56
format({valueOf: () => 56789.01}); // ==> 56,789.01
format(new Date()); // ==> 1,476,977,151,388

I would also expect from this helper to accept a value of any type.

Thank you.

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