Skip to content

Commit

Permalink
Add Date.addMinute()
Browse files Browse the repository at this point in the history
  • Loading branch information
dresende committed Feb 27, 2012
1 parent 345029a commit 9b39d00
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*
* Extension
* ---------
* .addMinute() Add one or more minutes to the Date
* .addHour() Add one or more hours to the Date
* .addDay() Add one or more days to the Date
* .addWeek() Add one or more weeks to the Date
Expand All @@ -17,6 +18,12 @@
(function () {
var Extensions = {};

Extensions.addMinute = function (n) {
var dt = new Date();
dt.setTime(this.getTime() + (60e3 * (n || 1)));

return dt;
};
Extensions.addHour = function (n) {
var dt = new Date();
dt.setTime(this.getTime() + (3600e3 * (n || 1)));
Expand Down

0 comments on commit 9b39d00

Please sign in to comment.