Business Days Calculator
Objective
Write a JavaScript function to calculate the number of business days between two given dates.
Requirements
The function should be called
calculateBusinessDays
The function should take two parameters:
startDate
- a string representing a date in the format "YYYY-MM-DD"endDate
- a string representing a date in the format "YYYY-MM-DD"
The function should return the number of business days between the two dates
Inclusive of
startDate
but exclusive ofendDate
The function should consider weekends to be non-business days
The following days should all be considered non-business days
New Year's Day: January 1st, or the following Monday if it falls on a weekend.
Good Friday: The Friday before Easter Sunday, which is the first Sunday following the full moon that appears on or after the March 21 equinox. For the purpose of this test you can consider Good Friday to be the 7th Apr or the Friday afterwards.
Easter Monday: The day after Easter Sunday.
Early May Bank Holiday: The first Monday in May.
Spring Bank Holiday: The last Monday in May.
Summer Bank Holiday: The last Monday in August.
Christmas Day: December 25, or the following Monday if it falls on a weekend.
Boxing Day: December 26, or the following Monday if it falls on a weekend.
If the
endDate
is equal to or before thestartDate
the function should return 0You can ignore any extra bank holidays added for special occasions.