startOf
Module Export
instant | date |> (granularity: Granularity, zone: Timezone) => instantThe instant at which the local period containing the input begins, in the given timezone.
Remarks
The offset is resolved at the boundary being returned, not at the input instant. That is what makes the result correct across a daylight saving transition: a month beginning while the zone is on summer time and one beginning after it has ended do not share an offset.
Weeks begin on Monday, per ISO 8601.
A date is accepted wherever an instant is, and is treated as midnight UTC.
See endOf for the exclusive upper edge, and periods when you need a whole series of buckets rather than a single boundary.
Examples
import 'calendar'
from 2026-08-15T12:00:00Z startOf ('month', 'Europe/Stockholm')
// Returns:// August began at 00:00 local, when Sweden was on UTC+22026-07-31T22:00:00Zimport 'calendar'
from 2026-11-15T12:00:00Z startOf ('month', 'Europe/Stockholm')
// Returns:// November began at 00:00 local, when Sweden was back on UTC+12026-10-31T23:00:00ZThe same instant truncates differently in different zones:
import 'calendar'
from 2026-08-15T12:00:00Z startOf ('day', 'Asia/Tokyo')
// Returns:2026-08-14T15:00:00Z