Date vs Daylight Savings
Southern Hemisphere? Would be my guess.
Axel
On Fri, Mar 11, 2011 at 12:12 AM, Luke Smith <lsmith at lucassmith.name> wrote:
The consistent behavior across all browsers of Date when passed a time made invalid by a DST jump is to roll the time back by an hour. // On a system with Pacific TZ new Date(2011, 2, 13, 2, 0, 0, 0); Sun Mar 13 2011 01:00:00 GMT-0800 (PST)
Mainly out of curiosity, is there a thread or a simple explanation of why back instead of forward? Am I incorrect in assuming most systems push the time forward?
Yeah. Try comparing output for both ;)
var date = new Date('2011-03-27') log(date.toString()); // Sun Mar 27 2011 01:00:00 GMT+0100 date.setHours(2); log(date.toString()) // Sun Mar 27 2011 01:00:00 GMT+0100
If you want to be sure to be timezone "free"*, use the UTC family (.setUTCHours, getUTCHours, etc).
- peter
(* You'll never be timezone free, but at least you won't be bothered with this hitch)
On Mon, Mar 21, 2011 at 6:54 PM, Peter van der Zee <ecma at qfox.nl> wrote:
On Fri, Mar 11, 2011 at 12:12 AM, Luke Smith <lsmith at lucassmith.name>wrote:
The consistent behavior across all browsers of Date when passed a time made invalid by a DST jump is to roll the time back by an hour. // On a system with Pacific TZ new Date(2011, 2, 13, 2, 0, 0, 0); Sun Mar 13 2011 01:00:00 GMT-0800 (PST)
Mainly out of curiosity, is there a thread or a simple explanation of why back instead of forward? Am I incorrect in assuming most systems push the time forward?
Yeah. Try comparing output for both ;)
var date = new Date('2011-03-27') log(date.toString()); // Sun Mar 27 2011 01:00:00 GMT+0100 date.setHours(2); log(date.toString()) // Sun Mar 27 2011 01:00:00 GMT+0100
Meh. Too fast.
var date = new Date('2011-03-27') date.setHours(2); log(date.toString()); // Sun Mar 27 2011 01:00:00 GMT+0100 date.setHours(3); log(date.toString()) // Sun Mar 27 2011 03:00:00 GMT+0200
The consistent behavior across all browsers of Date when passed a time
made invalid by a DST jump is to roll the time back by an hour. // On a system with Pacific TZ new Date(2011, 2, 13, 2, 0, 0, 0); Sun Mar 13 2011 01:00:00 GMT-0800 (PST)
Mainly out of curiosity, is there a thread or a simple explanation of
why back instead of forward? Am I incorrect in assuming most systems
push the time forward?
Thanks, L