locbet / jquery-numberformatter

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

precision of parsed number that is a percentage #49

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.jQuery.parseNumber( '5%' ) => 0
2.jQuery.parseNumber( '16% ) => 0.2
3.jQuery.parseNumber( '24%' ) => 0.2

What is the expected output? What do you see instead?
Results should be 0.05, 0.16, and 0.24 respectivbely

What version of the product are you using? On what operating system?
numberformatter 1.2.2 with jQuery 1.4.4

Please provide any additional information below.
[1] Number.prototype.toFixed uses $ in place of jQuery
[2] In jQuery.parseNumber function, if number is a percentage, the minimum 
precision must be 2

Original issue reported on code.google.com by kennedi...@yahoo.ca on 25 Aug 2011 at 2:16

GoogleCodeExporter commented 8 years ago
Simply removing the "-1" from the value passed to toFixed() on line 441 seems 
to solve the issue. This drove me crazy for a while though, I couldn't figure 
out why it was chopping off the last decimal place every time.

Original comment by darwinca...@gmail.com on 29 Aug 2011 at 5:14

GoogleCodeExporter commented 8 years ago
Thanks both. Looks like a duplicate as pointed out, will double-check when I 
get to the next release build work.

Original comment by apar...@gmail.com on 11 Sep 2011 at 4:38

GoogleCodeExporter commented 8 years ago
Should now be fixed as per issue #47.

Original comment by apar...@gmail.com on 5 Feb 2012 at 1:40