globalizejs / globalize

A JavaScript library for internationalization and localization that leverages the official Unicode CLDR JSON data
https://globalizejs.com
MIT License
4.8k stars 605 forks source link

parseNumber not returning NaN for trailing decimal #897

Closed xtgrant closed 3 years ago

xtgrant commented 4 years ago

I'm using latest version. Trying to parse a number onKeyUp in en locale. Globalize("en").numberParser()("123.") // returns the value 123 Shouldn't this return NaN?

rxaviers commented 3 years ago

This is expected (since some use cases depend on this feature [1]) thought it could be revisited if there's strong argument against it.

1: Incrementally parsing a number input (as typed).