addWeekDays
Calculates the date after adding the given number of business days.
- Use
Array.from()
to construct an array withlength
equal to thecount
of business days to be added. - Use
Array.prototype.reduce()
to iterate over the array, starting fromstartDate
and incrementing, usingDate.prototype.getDate()
andDate.prototype.setDate()
. - If the current
date
is on a weekend, update it again by adding either one day or two days to make it a weekday. - NOTE: Does not take official holidays into account.