Why Does Momentjs Isdst() Return Wrong Time When Zone() Is Used
I'm trying to check for isDST() (returns true or false if daylight saving time is active). It works fine if I use the current date time- for example var isdst = moment().isDST() re
Solution 1:
A time zone is not the same as an offset. UTC+01:00 applies to many different time zones, some use daylight saving time and some do not. Those that use it do not all apply it at the same time either. See "Time zone != Offset" in the timezone tag wiki.
Moment's "zone" function is really for specifying an offset. It will still use your own local DST rules.
If you want to know about DST rules for another time zone, you have to specify that zone using the moment-timezone add-on. For example:
var tz = 'Europe/Paris'; // or whatever your time zone isvar dt = '2014-05-14 12:34:56'; // or whatever date/time you're working with
moment.tz(dt,tz).isDST() // returns true in this case
Post a Comment for "Why Does Momentjs Isdst() Return Wrong Time When Zone() Is Used"