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() returns true for my timezone. However, what I want to do is first set the timezone offset and then check to see if daylight saving time is active in that timezone. I have the following code below.
var isdst = moment('2014-03-28').zone('+01:00');
console.log('daylight savings for +0100 is ' + isdst); //returns true when it should return false
If you look at the DST time for timezone +0100 (European Union countries) it does not come into effect until March 30, 2014. However, the code above returns true for March 28 when in fact should not (until 2 days later). You can check the DST for different countries here http://www.worldtimezone.com/daylight.html
I did some more testing and it seems that the code is taking into account my own timezone (US Eastern Standard) when it runs. If you see the site above, the Eastern Standard daylight saving begins on March 9, 2014. If I test the code a couple days previous to March 9 it returns false (i.e. March 8). If I test it with March 11 it returns true. This tells me that it is not taking into account the zone("+0100") and somehow using my timezone...why? How can I set the timezone for a momentjs date? I looked in the documentation (http://momentjs.com/docs/) and it says that this is the correct way, but it is not working for me.