imgrooot Posted June 25, 2021 Share Posted June 25, 2021 Here's what I'm trying to do. 1. A user creates a calendar that shows which dates he's available. This calendar could showcase availability for up to a year. 2. Other users can do a search for a user that's available on a set date. For e.g. July 1st. 3. All the users available on July 1st will show up in the search results. There is no booking for appointments involved. It simply needs to show the users available on set dates. I am wondering what's the best way to create this calendar feature? Quote Link to comment https://forums.phpfreaks.com/topic/312972-whats-the-best-way-to-create-a-booking-calendar-system/ Share on other sites More sharing options...
maxxd Posted June 25, 2021 Share Posted June 25, 2021 (edited) Available at all on a select date or available within a given time frame on a select date? If the only spec is that there are no other appointments or events on that person's calendar on that specific date, that's a simple question of a subquery where select all events on date are null. If you're talking time, that gets complicated with start times, end times, and overlaps of either or both. Edited June 25, 2021 by maxxd Quote Link to comment https://forums.phpfreaks.com/topic/312972-whats-the-best-way-to-create-a-booking-calendar-system/#findComment-1587533 Share on other sites More sharing options...
requinix Posted June 25, 2021 Share Posted June 25, 2021 If you only care about checking individual dates that are available, that's fairly easy: store the unavailability dates as rows of start and end dates, then search for rows based on whether the day is between them. If you care about checking date ranges then it's a bit trickier, but still not as complicated as it might sound: a conflict is any row where the desired start date is before the unavailable end date, and the desired end date is after the unavailable start date. Quote Link to comment https://forums.phpfreaks.com/topic/312972-whats-the-best-way-to-create-a-booking-calendar-system/#findComment-1587534 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.