Working Hours & Holidays
Set when your centre is open and define holidays.
Working Hours & Holidays
Working hours define when a centre is open for business. Holidays define dates when the centre is closed (fully or partially). Together with doctor availability rules, these determine when appointment slots are generated.
Setting Working Hours
Working hours are configured as a weekly schedule for each centre. Each day of the week (Monday through Sunday) has:
- is_open: whether the centre operates on this day
- Time Windows: one or more time ranges when the centre is open, specified as minutes from midnight
Time Representation
Times are stored as minutes from midnight (0 to 1440):
Minutes | Time |
|---|---|
0 | 12:00 AM (midnight) |
480 | 8:00 AM |
540 | 9:00 AM |
720 | 12:00 PM (noon) |
1020 | 5:00 PM |
1200 | 8:00 PM |
1440 | 12:00 AM (end of day) |
A centre open 9 AM to 5 PM would have a single time window: start_minutes=540, end_minutes=1020.
Split Shifts
Centres with breaks in the middle of the day can define multiple time windows per day. For example, a clinic open 9 AM–1 PM and 4 PM–8 PM would have two windows:
- Window 1: 540 to 780 (9:00 AM to 1:00 PM)
- Window 2: 960 to 1200 (4:00 PM to 8:00 PM)
Updating Working Hours
When you set working hours, the entire weekly schedule is replaced. You must provide the complete week's schedule, not just the days you want to change. Days not included are treated as closed.
Holiday Management
Holidays represent specific dates when the centre is closed or has reduced hours.
Full-Day Holidays
A full-day holiday closes the centre for the entire day. No appointment slots are generated on this date regardless of doctor availability.
Partial-Day Holidays
A partial-day holiday allows the centre to operate during specific hours. For example, a half-day holiday might keep the centre open from 9:00 AM to 1:00 PM only.
Partial holidays use the same time window format (minutes from midnight) as working hours. Only the specified windows are operational; the rest of the day is blocked.
Adding and Removing Holidays
- Add holidays one at a time, specifying the date (epoch seconds), name, and whether it is a full day
- For partial holidays, also provide the time windows when the centre remains open
- Remove holidays by date — the system finds and deletes the holiday matching that date
- Duplicate holidays are prevented — you cannot add two holidays on the same date
How Working Hours Affect Appointments
Working hours act as a container for slot generation. The system generates appointment slots at the intersection of:
- Centre Working Hours: when the centre is open
- Doctor Availability: the doctor's schedule, blocks, and overrides
- Centre Timezone: for correct local time calculation
If a doctor is available from 8 AM to 6 PM but the centre is only open 9 AM to 5 PM, slots are generated only during the overlapping window: 9 AM to 5 PM.
Holidays override working hours. On a full-day holiday, no slots are generated even if a doctor has availability configured for that date.
Priority Order
When computing available time windows for a date:
- Check for holidays — if a full-day holiday exists, no slots are available
- If partial holiday, use the holiday time windows instead of regular working hours
- Otherwise use the regular working hours for that day of the week
- Intersect centre hours with doctor availability to get final slot windows
Last updated on