osrec / currencyFormatter.js

A super simple currency formatting library
MIT License
635 stars 61 forks source link

Parsing force toFixed 2 decimals #28

Closed cdiaz closed 6 years ago

cdiaz commented 6 years ago

For this case:

OSREC.CurrencyFormatter.parse('€ -99,50', { locale: 'it' });

The current behavior return: -99.5 The expected behavior is: Returns -99.50

Is there any way to do it?

osrec commented 6 years ago

Remember, the value returned is a numeric type, not a string. Therefore, you should use val.toFixed(2) on the returned value.