Syafiqq / jquery-numberformatter

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

Percent: Re-parsing error #47

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.JavaScript:
    $("#testPercent").blur(function(){
        //alert($(this).val()+' -- '+$(this).parseNumber({format:"#.##%", locale:"us"}));   
        $(this).parseNumber({format:"#.##%", locale:"us"});     
        $(this).formatNumber({format:"#.##%", locale:"us"});
    });
HTML
<input id="testPercent" type="text" tabindex="1" />
2.Enter 3.33%. Tab out. Results is 3.3%. Expected: 3.33%
3. Tab in

What is the expected output? What do you see instead?
Expected: 3.3%. Result: 3%. Repeat again. Expected: 3% Result: %

What version of the product are you using? On what operating system?
1.2.2. jQuery 1.6.2.

Please provide any additional information below.

Original issue reported on code.google.com by discover...@gmail.com on 24 Aug 2011 at 7:11

GoogleCodeExporter commented 9 years ago
Duplicate issue. Remove "-1" from line 441.

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

GoogleCodeExporter commented 9 years ago
Thanks both, will be looking into it for the next release.

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

GoogleCodeExporter commented 9 years ago
If you make the following change

$("#riskfreeinterestrate").blur(function () {
        $(this).parseNumber({ format: "##.###%", locale: "us", round: false });
        $(this).formatNumber({ format: "##.###%", locale: "us", round: false });
    });

i.e. round:false then this resolves the issue, i.e. no more rounding of the 
percentage

Original comment by david.la...@gmail.com on 27 Sep 2011 at 8:48

GoogleCodeExporter commented 9 years ago
Fixed as or r17 and will be released for 1.2.3.

This was actually a problem with the parsing function, with it rounding 
incorrectly.

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