Skip to content

Commit

Permalink
Fixes #14
Browse files Browse the repository at this point in the history
  • Loading branch information
asual committed Sep 28, 2013
1 parent 07ffee4 commit 9732dfc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/jquery.format.js
Expand Up @@ -450,7 +450,7 @@
if (typeof parts[1] != UNDEFINED) {
for (i = 0; i < maxFraction; i++) {
if (parts[1].substr(i, 1) == '0' && i < maxFraction - 1 &&
(tempFraction.length != maxFraction || tempFraction.substr(0, 1) == '0')) {
tempFraction.length != maxFraction) {
tempFraction = '0' + tempFraction;
} else {
break;
Expand Down
6 changes: 3 additions & 3 deletions test/jquery.format-1.3.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions test/test.js
Expand Up @@ -89,6 +89,9 @@ test("Basic requirements", function() {
equals($.format.number(5.1001, '#,##0.000'), '5.100');
equals($.format.number(1, "#,##0.00"), '1.00');
equals($.format.number(1.2, "#,##0.#"), '1.2');
equals($.format.number(0.0098, "0.000"), '0.010');
equals($.format.number(0.00098, "0.0000"), '0.0010');
equals($.format.number(0.000098, "0.0000#"), '0.0001');

equals($.format.number(23540.23, '#,###.##'), '23,540.23');
equals($.format.number(23540.23, '#,###'), '23,540');
Expand Down

0 comments on commit 9732dfc

Please sign in to comment.