Account for DST offsets
Fauntleroy opened this issue · comments
Can you share the code you're using for this calculation? Keeping up to speed with DST every year is not something I care to take on, thus out of scope for the project.
There's got to be a way for this to be handled by the native Date
's knowledge of DST.
I assume the problem is that November 1st inside DST, but right now we're not, so when we instantiate Date
it uses the current DST status and doesn't keep track of it any further than that.
This is basically what I'm doing:
I have a Handlebars Helper:
var strftimeTZ = require('strftime').strftimeTZ;
var newDate = require('new-date');
module.exports = function( date_string, format, offset ){
offset = ( typeof offset === 'number' ) ? offset : null;
var date = newDate( date_string );
return strftimeTZ( format, date, offset );
};
And I use the helper like so
There's no way for strftime to know that the offset should be adjusted for DST. I suggest adjusting the offset before passing it in, if necessary. Closing this one.