Mottie / javascript-number-formatter

Lightweight & Fast JavaScript Number Formatter
http://mottie.github.io/javascript-number-formatter/
MIT License
141 stars 37 forks source link

Failing at differently sized groups #23

Open rotsee opened 5 years ago

rotsee commented 5 years ago

Thank you for a great library. There seem to be a bug for some numbers patterns with Indian style grouping (the default in Indian English, for instance):

> format("#,##,##0.###",2000000)
'2,000,000'

(Excepted: 20,00,000)

For reference, here's how it looks in Google Closure: https://github.com/google/closure-library/blob/master/closure/goog/i18n/numberformat.js#L892

Mottie commented 5 years ago

Hi @rotsee!

Oops, yes... the library is only checking the size of the last group. It'll need to be refactored to format the Indian format grouping. Thanks for reporting the problem. I don't know when I'll have time to work on it. 😞