If I try to pull first day number from November, this works fine:
var d = new Date(2013, 10, 1); // 1st of November 2013
d.toISOString(); // 2013-11-01T00:00:00.000Z (November)
d.getDay(); // 5 (Correct, 1st of November = Friday = 5)
However due to daylight savings time in the UK (the clocks going forward by one hour at the end of October), if I try to pull the first day of October, the date ends up being set to 23:00 on the previous day:
var d = new Date(2013, 9, 1); // 1st of October 2013
d.toISOString(); // 2013-09-30T23:00:00.000Z (September)
d.getDay(); // 2 (Last day number of September)
How can I handle this so that I always get 00:00:00 on the 1st of the month, regardless of daylight savings time (and any other clock adjustments wherever a user may be in the world)?