# `OpeningHours`

When a place is open each week and the days that differ, read by the clock in its zone (OpenStreetMap's `opening_hours`): `Mo-Fr 09:00-17:30; Sa 10:00-16:00; 2026 Dec 25 off [Europe/London]`. `temporal.open_at` asks whether it is open at an instant.

[Time and calendar](types.md#time-and-calendar); not ordered; since Jadpo 0.1.0.

## Make one

Build one from its text, `OpeningHours("Mo-Fr 09:00-17:30; Sa 10:00-16:00 [Europe/London]")`, which checks it: text that isn't one breaks `format`.

`text.parse(raw, as: OpeningHours)` reads one from its text; text that isn't one at all fails `malformed`, such as `Mo-Fr 09:00-17:30`, `Mo-Fr 9:00-17:30 [Europe/London]` or `Mo-Fr 09:00-25:00 [Europe/London]`.

## Text, JSON and storage

`text.from` writes its canonical text, the one form `text.parse` reads back. JSON sends its canonical text as a string.

| Text | JSON |
|---|---|
| `Mo-Fr 09:00-17:30; Sa 10:00-16:00 [Europe/London]` | `"Mo-Fr 09:00-17:30; Sa 10:00-16:00 [Europe/London]"` |
| `Mo-Th 17:00-23:00; Fr,Sa 17:00-02:00; 2026 Dec 25 off [America/New_York]` | `"Mo-Th 17:00-23:00; Fr,Sa 17:00-02:00; 2026 Dec 25 off [America/New_York]"` |

It is stored in one column named for the field, of type `text`. `Mo-Th 17:00-23:00; Fr,Sa 17:00-02:00; 2026 Dec 25 off [America/New_York]` is stored as `'Mo-Th 17:00-23:00; Fr,Sa 17:00-02:00; 2026 Dec 25 off [America/New_York]'`.

## Shown to people

`text.format(value, locale:)` shows it to people in their locale.

With `locale: Locale.en_gb`:

| Value | Shown |
|---|---|
| `Mo-Fr 09:00-17:30; Sa 10:00-16:00 [Europe/London]` | `Mo-Fr 09:00-17:30; Sa 10:00-16:00 [Europe/London]` |
| `Mo-Th 17:00-23:00; Fr,Sa 17:00-02:00; 2026 Dec 25 off [America/New_York]` | `Mo-Th 17:00-23:00; Fr,Sa 17:00-02:00; 2026 Dec 25 off [America/New_York]` |

## Operations

- `temporal.open_at(hours: OpeningHours, at: Instant) -> Bool`: Whether `hours` are open at `at`, by the clock in their zone.

Like every standard type, it also has the contract's own operations: `text.parse`, `text.from`, `text.format`, `json.read`, `json.write` and `==`. It isn't ordered, so `<` and sorting don't take it. [Every standard type meets one contract](../topics/every-standard-type-meets-one-contract.md) says how they work.
