Creating a list of dates to reference against non working days module

Good evening, I have a scenario where I need to compare a list of dates against non working days (public holiday, weekends, previously booked holidays). I am using the weekend calculator module to store the non working days. The problem being that I only have a start date and an end date in my entity. I need to get a list of the dates in between the start and end date and compare these also. I'm having difficulty creating a list of these dates and wondered if anyone has used the module before and what approach they took to compare a list of dates? Regards, Matt Smith
1 answers


Here are two suggestions:

1) If you have the non working days stored in an entity lets say: 13-12-2014 14-12-2014 And you have a start and end date on your entity, say: Start: 08-12-2014 End: 15-12-2014 You could do a simple retrieve action comparing the start and end with the date of the non working days entity.

2) Another method could be to generate the days from your start to end by using the datetime functions. So the first day is your start day then second one is start+1day, until the day = end. Create non-persistent objects for this and add the values to a list. Now you have all days in a list and a list of non-working days. Now loop over the list of non-working days a perform a find action on the days list. If the non-working day is found in the days list, remove it from the list and at the end of the loop you're left with a list of working days.