Skip to content

Timezone

Module Export

Timezone: 'Africa/Abidjan' | 'Africa/Accra' | … | 'Pacific/Wallis' | 'UTC'

A type matching any IANA timezone id.

Remarks

A literal union of every zone id in the bundled timezone database — around 600 of them, so the definition above is elided. Anything you would recognise as an IANA id (Europe/Stockholm, America/New_York, Asia/Tokyo, UTC) is a member.

The value of the type is that it moves the check to the boundary of your script. Typing a parameter as Timezone turns a misspelled zone into a compile-time error, rather than a failure deep inside a calculation, or worse, a plausible-looking number computed against the wrong zone.

'UTC' is an ordinary member with no special standing. There is deliberately no way to ask for “the local zone” — the machine a script happens to run on is not a meaningful answer.

Casing

Ids use canonical casing: Europe/Stockholm, not europe/stockholm or EUROPE/STOCKHOLM. Literal text types match exactly, so a wrong-cased id is a type error.

IANA itself treats ids case-insensitively, so this is stricter than the standard. It is also the only check — there is no lenient fallback later, because a value has to satisfy Timezone to reach a calendar function at all. If you are passing a zone from outside, canonical casing is your responsibility. Browsers already comply: Intl.DateTimeFormat().resolvedOptions().timeZone returns a canonical id.

Deprecated aliases

The database carries historical aliases such as Asia/Calcutta for Asia/Kolkata, and US/Eastern for America/New_York. These are accepted, because they still appear in real data and rejecting them would be unhelpful. They resolve to the same zone as their modern equivalent.

Examples

import 'calendar'
param zone: Timezone = 'Europe/Stockholm'
from now startOf ('day', zone)

A misspelled or wrong-cased zone fails to compile:

import 'calendar'
// Error: 'europe/stockholm' is not a valid Timezone
param zone: Timezone = 'europe/stockholm'
from zone

Aliases are accepted and resolve to the modern zone:

import 'calendar'
from 2026-07-15T12:00:00Z offsetAt 'Asia/Calcutta'
// Returns:
330 minutes