globalize icon indicating copy to clipboard operation
globalize copied to clipboard

Currency parsing

Open rxaviers opened this issue 10 years ago • 3 comments

Implement currency parsing

Ref #238

Depends on:

  • [x] #353

rxaviers avatar Dec 10 '14 16:12 rxaviers

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.

goatandsheep avatar Dec 22 '17 16:12 goatandsheep

True, it might have been a typo, would you like to submit a fix PR? Thanks for spotting it!

rxaviers avatar Dec 22 '17 16:12 rxaviers

I have an idea, actually. What if we:

  1. Parse the currency string for numbers, commas, and periods: valueString.replace(/[^\d\.\,]/g, '')
  2. 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

goatandsheep avatar Dec 28 '17 16:12 goatandsheep