Browse files

Tweaked date math behavior for DST boundaries, should address issue #11

  • Loading branch information...
1 parent 10bfea2 commit bed7415bc0631616bf34563d402e73e647c390ad @mattpat mattpat committed Mar 10, 2013
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/increment.js
View
8 lib/increment.js
@@ -71,7 +71,7 @@ Date.prototype.addDay = function(){
this.addMonth();
}
else
- this.setDate(d);
+ this.setTime(this.getTime() + (24 * 60 * 60 * 1000));
};
Date.prototype.addHour = function(){
@@ -82,7 +82,7 @@ Date.prototype.addHour = function(){
this.addDay();
}
else
- this.setHours(h);
+ this.setTime(this.getTime() + (60 * 60 * 1000));
};
Date.prototype.addMinute = function(){
@@ -93,7 +93,7 @@ Date.prototype.addMinute = function(){
this.addHour();
}
else
- this.setMinutes(m);
+ this.setTime(this.getTime() + (60 * 1000));
};
Date.prototype.addSecond = function(){
@@ -104,5 +104,5 @@ Date.prototype.addSecond = function(){
this.addMinute();
}
else
- this.setSeconds(s);
+ this.setTime(this.getTime() + 1000);
};

0 comments on commit bed7415

Please sign in to comment.