Skip to content
This repository

Support Custom Number Formats #88

Open
jamiemthomas opened this Issue January 11, 2012 · 3 comments

3 participants

Jamie Thomas erethnor Jan Hrabowski
Jamie Thomas

Currently globalize supports standard formats for dates and numbers and custom formats just for dates. Often it is nice to be able to specify custom formats for numbers as well, such as $#,##0.00;-$#,##0.00;- for currency instead of using the accounting syntax. Please round out this library by providing full support for both standard and custom format strings for numeric types.

erethnor

+1, it really is necessary in some cases.

A plugin that already handles this functionality (although not perfectly) is http://code.google.com/p/jquery-numberformatter/, perhaps it could be useful as starting point.

Jan Hrabowski

I would recommend to implement what is described below. Taken from http://www.ibm.com/developerworks/opensource/library/os-jquerynewpart1/index.html

For example, when you're talking a signing bonus for a new job, you may write your desired signing bonus as "$24k", with the "k" representing "thousands". This type of abbreviation is common in the US, with "k" for thousands, "M" for millions, and "B" for billions. Unfortunately, this is not possible in the Globalize plugin formatting right now, without writing your own Culture object to do so.

erethnor

I started to implement custom numeric formats in my fork.
Currently it fails several tests and it's definitely not ready to be used, but very simple formats such as "#,###.0000" should be working.

I will update this issue with a pull request once it's stable enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.