diff --git a/lib/index.js b/lib/index.js index 4662d34..29c9d7e 100644 --- a/lib/index.js +++ b/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; diff --git a/test/test.js b/test/test.js index a05d26a..fe0b84a 100644 --- a/test/test.js +++ b/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')