Prompt
How do I make booking availability respect working hours?
Latest observation
Oct 16, 2026
OpenAI APIWeb search: off
To make booking availability respect working hours, you need to ensure your booking rules only generate or allow time slots that fall within the business’s defined working schedule.
General approach
-
Store working hours
- Save opening/working hours per day of week.
- Example:
- Mon–Fri: 09:00–17:00
- Sat: 10:00–14:00
- Sun: closed
-
Check working hours when generating slots
- When creating available booking slots, only include slots that:
- Start after opening time
- End before closing time
- Fit the service duration
- When creating available booking slots, only include slots that:
-
Validate bookings on save
- Even if the UI shows valid slots, re-check on the backend when a booking is submitted.
- Reject bookings outside working hours.
-
Consider timezone
- Make sure working hours are interpreted in the correct local timezone for the business.
-
Account for breaks and exceptions
- Exclude lunch breaks, holidays, and special closures if needed.
Example logic
If working hours are 9:00–17:00 and the service takes 1 hour:
- Allowed slots: 9:00, 10:00, 11:00, 12:00, 13:00, 14:00, 15:00, 16:00
- Not allowed: 16:30, because it would end after 17:00
Pseudocode
for slot in all_possible_slots:
if slot.start >= opening_time and slot.end <= closing_time:
available_slots.append(slot)
If you want, I can give you:
- a specific implementation for your stack,
- a database schema for working hours,
- or help debug your current booking logic.