Permalink
Browse files

actually pad day of year for %j, closes #22

  • Loading branch information...
1 parent a3ef8f7 commit 2e6443f3941ea6ed46e3559cb9ee2c102a8c8f2c @samsonjs committed Apr 8, 2013
Showing with 3 additions and 1 deletion.
  1. +1 −1 strftime.js
  2. +2 −0 test/test.js
View
@@ -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);
View
@@ -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 {

0 comments on commit 2e6443f

Please sign in to comment.