openexchangerates / accounting.js

A lightweight JavaScript library for number, money and currency formatting - fully localisable, zero dependencies.
http://openexchangerates.github.io/accounting.js
MIT License
4.96k stars 530 forks source link

unformat() should use the default decimal separator #43

Closed fmntf closed 12 years ago

fmntf commented 12 years ago

I think it is generally better to default to the decimal separator provided in the settings object instead of '.' for the unformat function.

This saves from calling accounting.unformat(v, accounting.settings.currency.decimal) a lot.

wjcrowcroft commented 12 years ago

Hey, thanks for this, and I agree - the only issue being: why default to the currency decimal vs. the number decimal?

You assume they'd be the same, I imagine settings.number.decimal should be the accepted default

What do you think?

fmntf commented 12 years ago

Yes, it makes sense. I used currency because I'm using accounting.js just to format/unformat currencies. But I think number is more appropriate.

wjcrowcroft commented 12 years ago

Ok great, if you're able to change the file on your branch, I can auto-merge it here!

fmntf commented 12 years ago

I think it is complete now

wjcrowcroft commented 12 years ago

Awesome! Thanks, merging now.