globalize
globalize copied to clipboard
Currency parsing
Implement currency parsing
Ref #238
Depends on:
- [x] #353
Until this feature is launched, please remove the "and parsing" from "Currency module provides currency formatting and parsing" on the README. It's extremely misleading.
True, it might have been a typo, would you like to submit a fix PR? Thanks for spotting it!
I have an idea, actually. What if we:
- Parse the currency string for numbers, commas, and periods:
valueString.replace(/[^\d\.\,]/g, '')
- Run
numberParser
Currency codes define the symbols and locale defines the number format. If we're just parsing the number, we can strip away the symbols and parse the number in the locale specified in the settings