locbet / jquery-numberformatter

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

Number of integral digits isn't set properly due to toFixed() method rounding up #81

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Initialize plugin with the numIntegralDigits set to 5 and number set to 
9999.99
eg. 
ele.flipCounter({
    number: 9999.99,
    numIntegralDigits: 5,
    numFractionalDigits: 2
})

What is the expected output? What do you see instead?
The counter initializes with 4 integral digits

What version of the product are you using? On what operating system?
flipCounter v 1.2
Mac OSX 10.8.5

Please provide any additional information below.
This issue can be fixed by changing line 476 to use Math.floor prior to 
applying toFixed():
eg:
var num_extra_zeros = num_integral_digits - 
Math.floor(number).toFixed().toString().length;

Original issue reported on code.google.com by vedran.s...@gmail.com on 17 Mar 2014 at 9:04