The simplest solution.
Date.prototype.addDays = function(days) { this.setDate(this.getDate() + parseInt(days)); return this; }; and then call
var newDate = new Date().addDays(2); //+2 days or
Date.prototype.addDays = function(days) { this.setDate(this.getDate() + parseInt(days)); return this; }; // and then call var newDate = new Date().addDays(2); //+2 days console.log(newDate); // or var newDate1 = new Date().addDays(-2); //-2 days console.log(newDate1); var newDate = new Date().addDays(-2); //-2 days