-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
incorrect result when there is no dot in mask #5
Comments
Hi @magicaner! This is the expected result when only one symbol is supplied in the mask. In the main readme, there is a note that better explains this behavior:
I created this demo to make testing the mask a little easier. |
Wow, I think I need to reword that note... I speaky betta Engrish den dat! |
but this works differently at zend framework number formatter. the following code: what version is most correct? |
and |
Well, this is a very different library from the Zend framework... this one does not support normalization, localization or precision settings. So, if you are asking for "correctness" I would say go for the Zend one, they have more eyes on their code and built-in locale support. |
And actually, browsers have started adding a method to format & localize numbers: var number = 123456.789;
// India uses thousands/lakh/crore separators
console.log(new Intl.NumberFormat('en-IN').format(number));
// → 1,23,456.789
// request a currency format
console.log(new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(number));
// → 123.456,79 €
// the Japanese yen doesn't use a minor unit
console.log(new Intl.NumberFormat('ja-JP', { style: 'currency', currency: 'JPY' }).format(number));
// → ¥123,457
// limit to three significant digits
console.log(new Intl.NumberFormat('en-IN', { maximumSignificantDigits: 3 }).format(number));
// → 1,23,000 |
understand. zend codes is server side, i needed client side implementation of same thing. :) |
I guess its a good idea to implement it exactly as in Excel. Excel-like patterns is the reason why people would consider this lib |
I wouldn't want to break the existing behavior. It would be better to enhance the library to include Excel-like patterns. |
for format like:
#,##0
it still shows all decimals, but sohuld not.The text was updated successfully, but these errors were encountered: