Opening hours
Opening hours are a shared part of SHADE for modules that need to know when something is open, such as appointments. A module keeps its own named sets of rules: a week of opening periods and the days that differ from it. SHADE works out from them when it is open, in the site's time zone. Opening hours have no screen or website feature of their own: a module shows the opening-hours field on a page of its own, and the appointments module is the only one that does today. The part is experimental.
They need no switch and no setup. They are always on.
What users can do
Users never deal with opening hours directly; they use them through a module's screens. Through the appointments module, editors and admins, on the module's Opening hours tab:
- Set the week: per weekday up to four periods (for example 09:00–12:30 and 13:30–17:00). A day without periods is closed.
- Add Closed days and other hours: a date that is closed all day (a holiday), or open at other hours than the week's (a late evening).
- Let an exception repeat: once (or each day until an end date), every week, every month on the same day, every month on the same weekday of the month (the first Monday, say) or every year. A repeating exception may have an end date, and every exception a note.
- Choose whose hours they set: the business's, or one location's own (see Appointments).
Changing the hours leaves existing bookings in place.
Who may do it
Opening hours check no permissions of their own: the module decides who may do what. For the appointments module:
| Action | Permission | Roles |
|---|---|---|
| See the opening hours | appointments.read | admin, editor |
| Change the opening hours | appointments.manage | admin, editor |
AI users have no appointments permissions. Admins get every module permission automatically. Without
appointments.manage the opening-hours field is shown read-only.
In the admin
There is no opening-hours screen. A module shows the opening-hours field on a page of its own. Today it appears in one place: Appointments in the sidebar's Bookings section, tab Opening hours.
The field has two parts:
- Opening hours: one row per weekday (Monday to Sunday). A closed day shows "Closed" and an Open button, which adds 09:00–17:00. Each period has two time inputs and a remove button. The add button disappears once a day has four periods, or when its last period ends at 23:59; a new period starts where the previous one ends. Above the rows: "Times are in the site's time zone, {zone}: change it under Settings."
- Closed days and other hours: the exceptions, each with a date, whether the day is closed or open at other hours (then with its own periods), how often it repeats, an end date if it repeats, and a note.
Saving checks the rules ("Ends before it starts", "Periods on one day may not overlap"). Everything is saved at once, and a save is checked against the rules as the screen loaded them: when another admin saved them meanwhile, nothing is saved, and the screen says so and offers to reload, so a change made meanwhile is never dropped. The texts are in English and Dutch.
The time zone is the site's: Settings → Site → Time zone (default Europe/Amsterdam, any time zone the server knows). One business, one time zone: opening hours use it, and retention and modules (analytics) count their days in it.
On the website
Nothing directly. A module works out its open times from the rules and shows them in the site's time zone and the page's language.
Rules and limits
| Setting | Limits | Default |
|---|---|---|
| Opening periods | at most 4 per day; a period starts before it ends; periods of one day may not overlap | all days closed |
| Exceptions | at most 366; a note of at most 100 characters; those that are over are dropped on save | none |
Settings that break these rules are refused.
Which exception decides: a closed day always wins over an opening on the same date, and an exception for one date wins over a repeating one. Where no exception applies, the week's periods hold.
How repeating works:
- Once: one date, or each day from the date until the end date.
- Every week: the same weekday as the date.
- Every month: the same day of the month, skipped in months that do not have it (the 31st).
- Every month on the same weekday: the same weekday in the same week of the month, such as the first Monday.
- Every year: the same date; 29 February only in leap years.
- An end date stops a repeating exception after it.
Time zones and clock changes: opening hours are local times ("09:00 in Amsterdam"); a module stores bookings as exact moments. On the spring clock change a local time that does not exist (02:30) moves forward by an hour; on the autumn change a local time that happens twice takes the first. Opening at 09:00 stays at 09:00 local on both sides of a change.
Looking ahead: SHADE works out the open times of at most 400 days at a time.
Who keeps what: each module has its own rules, named by the module (the appointments module has default for the
business and one per location). Another module never sees them. When a module is removed, its rules are backed up and
forgotten.
Audit: saving the rules records a time-rules.update entry; see Audit.
Across languages: opening hours are not translated. Times are formatted in the reader's language by the module.
For developers
How a module uses them: Time rules. The code
and its tests: shade/business/time-rules/README.md in the shade repository.