'Intersecting time slots
I am working on a booking system which works around the user selecting a time slot and I am stuck attempting to check for overlapping bookings.
I am attempting to create a function which returns all the available time slots. I have an array called bookings which are the bookings for that day, and I have an array called slots.
I have tried looping through the arrays and attempting this:
if (slot.start > booking.dateStart.clone().addMinutes(-30) && slot.end < booking.dateEnd.clone().addMinutes(30))
To check for any overlap, and if there is I splice the slot from the array. I need to leave a 30 minute gap between each booking so that is why I am adding minutes.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
