Given a range of dates, number of days needs to be calculated excluding holidays given and certain days each week(weekly offdays).
The holidays will be an array
of dates but weekly offdays will just be a number, [0, 1, 2, 3, 4, 5, 6]
, representing days of the week.
The following is what i have tried so far:
export const calculateWorkingDays = (startDate, endDate, weeklyOffDays, holidays) => {
// Get difference between start and end dates
// Not used other parameters yet
return startDate.diff(endDate, 'days');
}
I dont yet know how to get weekly off days
dates from the number representation and also how to subtract given days(weekly off days and holidays) from date range then get remaining days count.