Javascript Date shiftDays(days)

Description

Javascript Date shiftDays(days)


Date.prototype.shiftDays = function(days){    
  days = parseInt(days, 10);/*from   w  w  w .  j a  v a 2  s.c o  m*/
  this.setDate(this.getDate() + days);
  return this;
}

$date = new Date(2014, 9, 16,0,1);
$date.shiftDays(1);
console.log($date-"");
$date.shiftDays(1);
console.log($date+"");
$date.shiftDays(1);
console.log($date-"");



PreviousNext

Related