Glossary / Time-zone correctness

Time-zone correctness

Time-zone correctness means representing and displaying temporal data according to its real meaning, the relevant time zone, and changing civil-time rules. A time zone is a region’s rule set, not a fixed UTC offset: offsets change with daylight-saving and political decisions. Systems should distinguish instants from local schedules and date-only values, persist enough information to reconstruct intent, and use maintained time-zone databases rather than fixed-offset assumptions.

Core model

Failure modes and testing

Avoid storing an appointment as a bare UTC instant if the user intended a recurring local time; avoid storing a local string without zone if it represents a unique event. Test DST boundary dates, zone changes, historical dates, leap days, midnight crossing, and machines configured in different zones. Make UI labels explicit (“your time”, “UTC”, or named zone) and show the zone for cross-region scheduling. Keep server, browser, and database assumptions aligned.

Interview questions

  1. Why is a UTC offset not a time zone? It is one offset at one moment; a region’s IANA zone contains historical and future rules.
  2. How model a recurring 9 a.m. meeting? Store local time, recurrence, and named zone, then resolve each occurrence under current zone rules.
  3. What is an ambiguous local time? A wall-clock time repeated during a backward clock change; the system must choose earlier/later occurrence or request clarification.
  4. What is a nonexistent local time? A wall-clock time skipped during a forward transition; define whether to shift, reject, or ask the user.
  5. How test time-dependent code? Inject a clock, pin zones, test DST boundaries, and avoid dependence on the machine’s current zone or date.

References