British Columbia, Time Zones, and Postgres
- Programming
- Databases
- Infrastructure
The post walks through a nasty but common edge case in time handling: British Columbia plans to stop switching clocks, which means a future appointment booked under today’s rules can map to a different UTC instant after the law changes. In Postgres terms, the warning is that `timestamptz` is great for recording an instant, but not always enough for representing a future event whose meaning is tied to a place’s wall clock. The practical fix is to model the thing you actually promised. If the promise is “2 PM at the Vancouver dentist,” store that local date and time with the relevant zone, then resolve it using current zone rules when needed.
Audit any system that stores future scheduled events as only UTC or Unix time. If the business promise is about local wall-clock time, keep the local date, local time, and time-zone identifier as first-class data and decide explicitly whose clock is authoritative.
- crunchydata.com
- Discuss on HN