Skip to content

Commit

Permalink
fix %b format fall through, test new %j and %C specifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonjs committed Nov 14, 2012
1 parent dae086e commit 4643912
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
case 'A': return locale.days[d.getDay()];
case 'a': return locale.shortDays[d.getDay()];
case 'B': return locale.months[d.getMonth()];
case 'b': // fall through
case 'b': return locale.shortMonths[d.getMonth()];
case 'C':
var y = String(d.getFullYear());
return y.slice(0,2);
Expand All @@ -90,7 +90,7 @@
case 'F': return _strftime(locale.formats.F || '%Y-%m-%d', d, locale);
case 'H': return pad(d.getHours());
case 'I': return pad(hours12(d));
case 'j':
case 'j':
var y=new Date(d.getFullYear(), 0, 1);
var day = Math.ceil((d.getTime() - y.getTime()) / (1000*60*60*24));
return day;
Expand Down
2 changes: 2 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ assert.format('%A', 'Tuesday')
assert.format('%a', 'Tue')
assert.format('%B', 'June')
assert.format('%b', 'Jun')
assert.format('%C', '20')
assert.format('%D', '06/07/11')
assert.format('%d', '07')
assert.format('%e', '7')
assert.format('%F', '2011-06-07')
assert.format('%H', null, '18')
assert.format('%I', null, '06')
assert.format('%j', null, '158')
assert.format('%k', null, '18')
assert.format('%L', '067')
assert.format('%l', null, ' 6')
Expand Down

0 comments on commit 4643912

Please sign in to comment.