Permalink
Browse files

fix %b format fall through, test new %j and %C specifiers

  • Loading branch information...
1 parent dae086e commit 4643912213a1b3e2cb48453643f69ec4de74c08c @samsonjs committed Nov 14, 2012
Showing with 4 additions and 2 deletions.
  1. +2 −2 lib/index.js
  2. +2 −0 test/test.js
View
4 lib/index.js
@@ -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);
@@ -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;
View
2 test/test.js
@@ -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')

0 comments on commit 4643912

Please sign in to comment.