locbet / jquery-numberformatter

Automatically exported from code.google.com/p/jquery-numberformatter
0 stars 0 forks source link

Number formatting generally does not work as expected #28

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Maybe I'm just using it the wrong way, but this plugin does not work for me at 
all. A few examples, tested on version 1.1.0:

A) $.formatNumber() does not work at all:

1. $.formatNumber(123456.789, {format: "#,##0.0", locale: "us"})
2. expected result: "123,456.8"
3. actual result "123456.789"

B) Dosn't work with other locales, either:

1. $.formatNumber(123456.789, {format: "#,##0.0", locale: "de"})
2. expected result: "123.456,8"
3. actual result "123456,789"

C) Formatting a number in an element also does not work:

1. $("<span>123456.789</span>").format({format: "#,##0.0", locale: "de"}).text()
2. expected result: "123.456,8"
3. actual result "123.456.789,0"

D) And also:

1. $("<span>0</span>").format({format: "#", locale: "us"}).text()
2. expected result: ""
3. actual result: "0"

It looks like this plugin has some serious issues.

I can understand, to a certain extent, that in C) the plugin expects the text 
value to be in the locale I ask for (maybe I should be able to specify an 
inputLocale parameter?).

Anaway that's the case $.formatNumber() should be able to handle, only that 
this function does not do anything useful at all. Looking at its 
implementation, it should be renamed to formatString() or something, because 
formatting a number is certainly not what it does. ;-)

Original issue reported on code.google.com by martin.b...@gmail.com on 16 Aug 2010 at 12:22

GoogleCodeExporter commented 8 years ago
Sorry 1.1.x is no longer supported :(

Have verified using version 1.2, 3/4 working exactly as specified above, see 
attached for details. The 4th (D) is however a bug, it should be blank as you 
say, will be fixing this for 1.2.1, thanks for reporting, I completely missed 
this one :)

Original comment by apar...@gmail.com on 9 Oct 2010 at 11:30

GoogleCodeExporter commented 8 years ago
Missing attachment...

Original comment by apar...@gmail.com on 9 Oct 2010 at 11:33

Attachments:

GoogleCodeExporter commented 8 years ago
Fixed in version 1.2.1.

Original comment by apar...@gmail.com on 9 Oct 2010 at 1:19