According to the 'Supported Specifiers' section:
j is the day of the year, padded to 3 digits (001-366)
console.log(strftime('%Y-%jT%H:%M:%S', new Date('2013-04-09T15:16:00.000Z')));
returns without a padded zero:
but should be:
It also appears that the function doesn't preserve the timezone but converts it to the browsers timezone.
I believe if you replace lies 116, 117 and 118 in strftime.js:
var y=new Date(d.getFullYear(), 0, 1);
var day = Math.ceil((d.getTime() - y.getTime()) / (1000*60*60*24));
return pad( Math.floor((new Date(d) - new Date((new Date(d)).getFullYear(), 0, 0))/(1000 * 60 * 60 * 24)), 3);
should pad the day of year correctly. However, this doesn't take care of the timezone issue.
actually pad day of year for %j, closes #22
Fixed, thanks for the report.
Do you have an example I can test with for the timezone issue? It behaves correctly here (PST).
Try a date of this type: '2013-04-09T15:16:00.000Z' where Z is Zulu time, i.e. GMT, i.e. UTC. In EST it should be in 2013-04-09T10:16:00.000 (5 hours difference) but what should be returned is the date and time formated for the originally provided timezone and not changed to the local time zone.
Of course, I could be doing something wrong.
One would not see this problem if one's machine is set to UTC/GMT/Z because in that case local is the same as UTC.
I see. Thanks for the feedback.