Open
Description
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.
Metadata
Metadata
Assignees
Labels
No labels