globalizejs / globalizejs/globalize
Parse percentage with decimals
- Dominant language
- JavaScript
- Stars
- 4.8k
- Forks
- 585
- PR merge metrics
- No merged PRs in 30d
Description
Globalize 1.2.2
The example speaks for itself:
Globalize.numberParser({style:"percent"})("50.555%"); => NaN
Globalize.numberParser({style:"percent", maximumFractionDigits: 2})("50.555%") => 0.50555 (actually 0.5055499999999999, but that is another problem)
In fact, I can put any number on the property maximumFractionDigits (which according to the documentation does not even exist on numberParser) and it will parse any number of decimals!
I would expect the first example to behave like the second, or I would like the documentation to be updated, and in that case also the bug which allows any number of decimals to be parsed no matter the value of maximumFractionDigits.
Contributor guide
Assessment
This issue has not been assessed yet.