I am completely confused, why does this not work?
I repeat the date range and just add 1 hour step by step. This went on until this week. Basically, the date falls on March 27, 2011 01:00:00 GMT + 0100. Then it just holds on and does not add anything. If I add + 3h, then it will work again, but not with +1.
I use Firebug on Firefox and also tried it in the console.
Sun Mar 27 2011 01:00:00 GMT+0100
>>> this.setHours(0);
1301180400000
>>> this.setHours(1);
1301184000000
>>> this.setHours(2);
1301184000000
>>> this.setHours(3);
1301187600000
This is the code:
Date.prototype.addHours = function (h) {
this.setHours(this.getHours() + h);
return this;
}
I have the same error in Safari and Chrome.
source
share