Skip to content
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

Number formatting with ”d” code – needs explanation & example fix #41

Closed
yucca42 opened this issue Jun 21, 2011 · 2 comments
Closed

Comments

@yucca42
Copy link

yucca42 commented Jun 21, 2011

The description of ”d” number formatting code as ”for decimal digits” sounds very odd. It seems that the format code ”d” really means using the non-localized JavaScript number format, just with left-padding the string with zeros to get a minimum width specified by number after the format character ”d”.

So Globalize.format( 123.45, "d" ) yields 123.45 (not 123 as currently in the documentation). Maybe the documentation is meant to use 123 as the first parameter, on the grounds that the ”d” format is really meant for integers only, isn’t it? Moreover, it should perhaps be emphasized that the result is not localized, e.g. Globalize.format( 1234, "d") yields 1234 independently of locale, not a localized presentation with a thousands separator (1,234 or 1 234 or something like that).

@yucca42
Copy link
Author

yucca42 commented Jun 21, 2011

Sorry for typo in the heading, I meant ”d” (as in my text), not ”n”.

@yucca42 yucca42 closed this as completed Jun 21, 2011
@rdworth
Copy link
Contributor

rdworth commented Jun 21, 2011

Duplicate of #42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants