forked from 0x2620/oxjs
rather use ''.slice than ''.substr
This commit is contained in:
parent
f990f3b857
commit
1608664bb6
20 changed files with 69 additions and 71 deletions
|
|
@ -153,7 +153,7 @@ Ox.formatDate = function(date, str, utc) {
|
|||
['d', function(d) {return Ox.pad(Ox.getDate(d, utc), 2);}],
|
||||
['e', function(d) {return Ox.pad(Ox.getDate(d, utc), 2, ' ');}],
|
||||
['G', function(d) {return Ox.getISOYear(d, utc);}],
|
||||
['g', function(d) {return Ox.getISOYear(d, utc).toString().substr(-2);}],
|
||||
['g', function(d) {return Ox.getISOYear(d, utc).toString().slice(-2);}],
|
||||
['H', function(d) {return Ox.pad(Ox.getHours(d, utc), 2);}],
|
||||
['I', function(d) {return Ox.pad((Ox.getHours(d, utc) + 11) % 12 + 1, 2);}],
|
||||
['j', function(d) {return Ox.pad(Ox.getDayOfTheYear(d, utc), 3);}],
|
||||
|
|
@ -185,7 +185,7 @@ Ox.formatDate = function(date, str, utc) {
|
|||
return Math.abs(y) + (y < 1000 ? ' ' + Ox.BCAD[y < 0 ? 0 : 1] : '');
|
||||
}],
|
||||
['Y', function(d) {return Ox.getFullYear(d, utc);}],
|
||||
['y', function(d) {return Ox.getFullYear(d, utc).toString().substr(-2);}],
|
||||
['y', function(d) {return Ox.getFullYear(d, utc).toString().slice(-2);}],
|
||||
['Z', function(d) {return d.toString().split('(')[1].replace(')', '');}],
|
||||
['z', function(d) {return Ox.getTimezoneOffsetString(d);}],
|
||||
['n', function() {return '\n';}],
|
||||
|
|
@ -496,8 +496,8 @@ Ox.formatNumber = function(num, dec) {
|
|||
str = Ox.isUndefined(dec) ? abs.toString() : abs.toFixed(dec),
|
||||
spl = str.split('.');
|
||||
while (spl[0]) {
|
||||
arr.unshift(spl[0].substr(-3));
|
||||
spl[0] = spl[0].substr(0, spl[0].length - 3);
|
||||
arr.unshift(spl[0].slice(-3));
|
||||
spl[0] = spl[0].slice(0, -3);
|
||||
}
|
||||
spl[0] = arr.join(',');
|
||||
return (num < 0 ? '-' : '') + spl.join('.');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue