# `Weekday`

A day of the week: `monday` to `sunday`.

Use it for opening days and weekly schedules. `temporal.weekday` gives one from a date. For a whole week's opening times, use [`OpeningHours`](/docs/types/type-opening-hours.md).

## Shape

One of these 7 values:

`Weekday.monday`, `Weekday.tuesday`, `Weekday.wednesday`, `Weekday.thursday`, `Weekday.friday`, `Weekday.saturday`, `Weekday.sunday`.

## Example

```jadpo
Weekday.monday
```

`text.parse(raw, as: Weekday)` reads one from text that comes from outside. Text that isn't one at all fails `malformed`, such as `mon` or `funday`.

This operation gives one: `temporal.weekday`.

## Good to know

- `==` tells you whether two are the same. `<` and `list.sort_by` don't take it.

## In JSON

A string, in a request, a response or `json.write`:

```json
"monday"
"sunday"
```

## Details

<details>
<summary>Text form, storage, how it is shown, and operations</summary>

`Weekday` is in the group Time and calendar, and has been in Jadpo since 0.1.0.

### Text form

`text.from` writes one standard text form, the same form `text.parse` reads back: `monday` and `sunday`.

### How it is stored

It is stored in one column named for the field, of type `text`. `sunday` is stored as `'sunday'`.

### How it is shown to people

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

With `locale: Locale.en_gb`:

| Value | Shown |
|---|---|
| `monday` | `Monday` |
| `sunday` | `Sunday` |

### Operations

- `temporal.week_bounds(date: CalendarDate, zone: Zone, starts_on: Weekday) -> InstantRange`: The week holding `date` in `zone`, starting on `starts_on`.
- `temporal.weekday(value: T) -> Weekday`: The day of the week.

It also takes `text.parse`, `text.from`, `text.format`, `json.read`, `json.write` and `==`. [How every standard type behaves](/docs/every-standard-type-meets-one-contract.md) says how they work.

</details>
