Fa876f707d4e3f879985bfd748c6f0d7

The function add or substracts business days to a date, you use like this
var date = new Date();
date = date.addBizDays(10);

Date.prototype.addBizDays = function(n){
 var day = this.getDay();
 var d =  new Date();
 var wkn = (n < 0 ? -2 : 2);
 d.setDate(this.getDate()+n+(day === 6 ? 2 : +!day) +(Math.floor((Math.abs(n)/5))*wkn));
 return d;
}

Refactorings

No refactoring yet !

Your refactoring





Format Copy from initial code

or Cancel