serg1uu
5/11/2018 - 7:21 AM

Increment date by X days

Useful when you want to add X days to a specific date.

Ex: 31 March + 4 days = 4 Apr

Date.prototype.addDays = function(d) {
   this.setTime(this.getTime() + d*86400000);
   return this;
};


startDate = new Date();
endDate = startDate.addDays(4);