diff --git a/src/jquery.format.js b/src/jquery.format.js index 4c99a3a..20e76ce 100644 --- a/src/jquery.format.js +++ b/src/jquery.format.js @@ -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; diff --git a/test/jquery.format-1.3.min.js b/test/jquery.format-1.3.min.js index f1f33e0..f5e0bb9 100644 --- a/test/jquery.format-1.3.min.js +++ b/test/jquery.format-1.3.min.js @@ -7,7 +7,7 @@ * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * - * Date: 2012-09-28 00:16:07 +0300 (Fri, 28 Sep 2012) + * Date: 2013-09-28 10:56:31 +0300 (Sat, 28 Sep 2013) */ (function(z){z.format=function(){var o={date:{format:"MMM dd, yyyy h:mm:ss a",monthsFull:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],daysFull:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortDateFormat:"M/d/yyyy h:mm a",longDateFormat:"EEEE, MMMM dd, yyyy h:mm:ss a"}, number:{format:"#,##0.0#",groupingSeparator:",",decimalSeparator:"."}};return{locale:function(b){a={a:6};if(b)for(var i in b)for(var g in b[i])o[i][g]=b[i][g];return o},date:function(b,i){var g=0,h=0,c=0;c=h="";var l,e;if(typeof b=="string"){var m=function(r,v,y,w){for(w=w;w>=y;w--){var x=r.substring(v,v+w);if(x.length>=y&&/^\d+$/.test(x))return x}return null};if(typeof i=="undefined")i=o.date.format;var d=0,n=new Date(0,0,0,0,0,0,0),j=n.getYear(),f=n.getMonth()+1,p=1,k=n.getHours(),t=n.getMinutes(), @@ -19,5 +19,5 @@ else d+=c.length}if(d!=b.length)return 0;if(f==2)if(j%4===0&&j%100!==0||j%400=== d=b.getDate();j=b.getDay();f=b.getHours();p=b.getMinutes();l=b.getSeconds();k=b.getMilliseconds();b={y:e,yyyy:e,yy:String(e).substring(2,4),M:m,MM:g(m),MMM:o.date.monthsShort[m-1],MMMM:o.date.monthsFull[m-1],d:d,dd:g(d),EEE:o.date.daysShort[j],EEEE:o.date.daysFull[j],H:f,HH:g(f)};b.h=f===0?12:f>12?f-12:f;b.hh=g(b.h);b.k=f!==0?f:24;b.kk=g(b.k);b.K=f>11?f-12:f;b.KK=g(b.K);b.a=f>11?"PM":"AM";b.m=p;b.mm=g(p);b.s=l;b.ss=g(l);b.S=k;b.SS=g(k);b.SSS=g(k,3);e="";g=0;c=h="";for(l=false;g4)c="MMMM";if(c.indexOf("EEEE")!=-1&&c.length>4)c="EEEE";e+=typeof b[c]!="undefined"&&!l?b[c]:c}}return e}},number:function(b,i){var g,h,c,l,e;if(typeof b=="string"){g=o.number.groupingSeparator;c=o.number.decimalSeparator;l=b.indexOf(c);e=1;if(l!=-1)e=Math.pow(10,b.length-l-1);b=b.replace(new RegExp("["+g+"]","g"),"");b=b.replace(new RegExp("["+c+"]"),"."); return Math.round(b*e)/e}else{if(typeof i=="undefined"||i.length<1)i=o.number.format;g=",";h=i.lastIndexOf(g);c=".";l=i.indexOf(c);var m=g="";c=b<0;var d=i.substr(l+1).replace(/#/g,"").length,n=i.substr(l+1).length,j=10;b=Math.abs(b);if(l!=-1){m=o.number.decimalSeparator;if(n>0){e=1E3;j=Math.pow(j,n);var f=Math.round(parseInt(b*j*e-Math.round(b)*j*e,10)/e);f=String(f<0?Math.round(parseInt(b*j*e-parseInt(b,10)*j*e,10)/e):f);var p=b.toString().split(".");if(typeof p[1]!="undefined")for(e=0;e=d&&n=="0"&&/^0*$/.test(f.substr(e+1)))break;p+=n}m+=p}if(m==o.number.decimalSeparator)m=""}if(l!==0){g=m!=""?String(parseInt(Math.round(b*j)/j,10)):String(Math.round(b));b=o.number.groupingSeparator;d=0;if(h!=-1){d=l!=-1?l-h:i.length-h;d--}if(d>0){h=0;j="";for(e=g.length;e--;){if(h!==0&&h%d===0)j=b+j;j=g.substr(e,1)+j;h++}g=j}h=/#|,/g;i=l!=-1?i.substr(0, -l).replace(h,"").length:i.replace(h,"").length;for(e=g.length;e=d&&n=="0"&&/^0*$/.test(f.substr(e+1)))break;p+=n}m+=p}if(m==o.number.decimalSeparator)m=""}if(l!==0){g=m!=""?String(parseInt(Math.round(b*j)/j,10)):String(Math.round(b));b=o.number.groupingSeparator;d=0;if(h!=-1){d=l!=-1?l-h:i.length-h;d--}if(d>0){h=0;j="";for(e=g.length;e--;){if(h!==0&&h%d===0)j=b+j;j=g.substr(e,1)+j;h++}g=j}h=/#|,/g;i=l!=-1?i.substr(0,l).replace(h,"").length: +i.replace(h,"").length;for(e=g.length;e