mirror of
https://github.com/samsonjs/strftime.git
synced 2026-04-27 14:57:37 +00:00
make %C pad the century, like C
This commit is contained in:
parent
e761363a45
commit
d7418223fd
2 changed files with 2 additions and 3 deletions
|
|
@ -77,9 +77,7 @@
|
||||||
case 'a': return locale.shortDays[d.getDay()];
|
case 'a': return locale.shortDays[d.getDay()];
|
||||||
case 'B': return locale.months[d.getMonth()];
|
case 'B': return locale.months[d.getMonth()];
|
||||||
case 'b': return locale.shortMonths[d.getMonth()];
|
case 'b': return locale.shortMonths[d.getMonth()];
|
||||||
case 'C':
|
case 'C': return pad(Math.floor(d.getFullYear() / 100));
|
||||||
var y = String(d.getFullYear());
|
|
||||||
return y.slice(0,2);
|
|
||||||
case 'D': return _strftime(locale.formats.D || '%m/%d/%y', d, locale);
|
case 'D': return _strftime(locale.formats.D || '%m/%d/%y', d, locale);
|
||||||
case 'd': return pad(d.getDate());
|
case 'd': return pad(d.getDate());
|
||||||
case 'e': return d.getDate();
|
case 'e': return d.getDate();
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ assert.format('%a', 'Tue')
|
||||||
assert.format('%B', 'June')
|
assert.format('%B', 'June')
|
||||||
assert.format('%b', 'Jun')
|
assert.format('%b', 'Jun')
|
||||||
assert.format('%C', '20')
|
assert.format('%C', '20')
|
||||||
|
assert.format('%C', '01', null, new Date(100, 0, 1))
|
||||||
assert.format('%D', '06/07/11')
|
assert.format('%D', '06/07/11')
|
||||||
assert.format('%d', '07')
|
assert.format('%d', '07')
|
||||||
assert.format('%e', '7')
|
assert.format('%e', '7')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue