Skip to content

Commit

Permalink
actually pad day of year for %j, closes #22
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonjs committed Apr 8, 2013
1 parent a3ef8f7 commit 2e6443f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion strftime.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
case 'j':
var y=new Date(d.getFullYear(), 0, 1);
var day = Math.ceil((d.getTime() - y.getTime()) / (1000*60*60*24));
return day;
return pad(day, 3);
case 'k': return pad(d.getHours(), padding == null ? ' ' : padding);
case 'L': return pad(Math.floor(d.getTime() % 1000), 3);
case 'l': return pad(hours12(d), padding == null ? ' ' : padding);
Expand Down
2 changes: 2 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ ok('Exports')
if (!process.env.TZ || process.env.TZ == 'America/Vancouver') {
testTimezone('P[DS]T')
assert.format('%C', '01', '01', new Date(100, 0, 1))
assert.format('%j', '097', '098', new Date(1365390736236))
ok('Time zones (' + process.env.TZ + ')')
}
else if (process.env.TZ == 'CET') {
testTimezone('CES?T')
assert.format('%C', '01', '00', new Date(100, 0, 1))
assert.format('%j', '098', '098', new Date(1365390736236))
ok('Time zones (' + process.env.TZ + ')')
}
else {
Expand Down

0 comments on commit 2e6443f

Please sign in to comment.