Skip to content

Weekday

Module Export

Weekday: 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday'

A type matching the days of the week.

Remarks

The type of the weekday field on CalendarParts.

Lower case, English, and ordered from Monday, matching ISO 8601 — the same convention 'week' follows in Granularity. These are identifiers rather than labels: they are not localised, and are meant for comparison and pattern matching rather than display.

Examples

import 'calendar'
let p = 2026-08-15T12:00:00Z parts 'Europe/Stockholm'
from p.weekday
// Returns:
'saturday'

Useful in a pattern match:

import 'calendar'
let day = (2026-08-15T12:00:00Z parts 'Europe/Stockholm').weekday
from day match
'saturday' |> 'weekend'
'sunday' |> 'weekend'
|> 'weekday'
// Returns:
'weekend'