0
How to get total no. of days excluding fri and sat between two dates in JavaScript?
I have two dates and I want to show total days between these two dates excluding holidays
1 Réponse
+ 1
var diff = (d2.getTime() - d1.getTime()) / (24 * 60 60 * 1000);
var result = diff - parseInt(diff * 2 / 7)
//this work with more than 7 days. if You want to test less, You have to use date.getDay() to know if is a fri or sat. date.getDay() starts with 0 and sunday
//diff*2 is because there are two days of holiday on week