showing results for - "javascript add business days to date"
Veronica
06 Sep 2018
1function add_bus_days(date, busDays) { // add business days to a date
2                var wkdy = date.getDay(); // get weekday number
3                var addDays = wkdy >= 3 ? (busDays + 2) : busDays; // if it's wednesday or later set add days to 5 instead of 3 to account for the weekend
4                date.setDate(date.getDate() + addDays); // add days to current date
5                return date
6            }
7// usage
8var dt = new Date(); // get date
9newDate = add_bus_days(dt, 3) // add 3 business days