3 ms·
Those are both supposed to return false. isDSTShifted() tells you whether the datetime you entered was shifted by the library because it doesn't exist in daylig
by dangrossman 11y ago
Those are both supposed to return false. isDSTShifted() tells you whether the datetime you entered was shifted by the library because it doesn't exist in daylight savings time. For example, in pseudocode, if you try to "add 1 day" to "2:30AM the day before DST begins", it'll be shifted because there is no 2:30AM on the resulting date. The clock skips from 1:59AM to 3AM that day.
Here's a fiddle showing isDSTShifted() working with the US DST start (I don't know what date to use for your location):
http://jsfiddle.net/d9tz0tv1/ http://jsfiddle.net/d9tz0tv1/
I think you're looking for isDST()?
- finchisko 11y agoOk you're test is failing in my timezone. But it is OK, as far I understand (still not 100% sure if I do) :-). But: moment('2015-25-10 2:00', 'YYYY-MM-DD HH:mm').isDST() moment('2015-25-10 3:00', 'YYYY-MM-DD HH:mm').isDST() return false. That's not correct in my TZ. Confused.
- finchisko 11y agoDo I have to call something like moment.tz() before isDST()?