Date picker - Block dates calculation

In my app, users can add their work schedule (eg. Monday-Friday) I then use these as block dates for the date/time picker plugin.

I’m trying to work out the best way to stop users choosing a date range which excludes the days they don’t work.

Heres an example
forumhelp
This user has picked 11th April (start date) and 18th April (finish date) this equals 8 days… but this user doesnt work Fri, Sat & Sun - which means it should only be 5 days.

Is there a date calculation or JS snippet i could use to delete the non-working dates from the date range?

Thanks

This topic was automatically closed after 70 days. New replies are no longer allowed.