principlejavascriptModerate
IANA timezone database — the source of truth for timezone rules
Viewed 0 times
IANA databasetzdatatimezone rulesDST changesICU data
nodedocker
Problem
Timezone rules change by government decree. Code that embeds timezone data at build time becomes stale, producing incorrect DST conversions after a political change.
Solution
Rely on the platform's timezone database, which is updated automatically. Keep Node.js, system packages, and Docker base images updated.
# Alpine Dockerfile — explicitly install tzdata
RUN apk add --no-cache tzdata
// Check engine vintage
Intl.DateTimeFormat().resolvedOptions().timeZone;
# Alpine Dockerfile — explicitly install tzdata
RUN apk add --no-cache tzdata
// Check engine vintage
Intl.DateTimeFormat().resolvedOptions().timeZone;
Why
Countries change timezone rules with little notice (Samoa skipped a day in 2011, Russia abolished DST in 2014). The IANA tz database tracks all changes. Stale embedded data produces wrong results.
Gotchas
- Docker Alpine images may ship without tzdata — install it explicitly
- Node.js bundles ICU at compile time — a new Node version may be needed after rule changes
- moment-timezone bundles its own tz database copy — update the package when rules change
Code Snippets
Update tzdata in Alpine Docker image
FROM node:20-alpine
RUN apk add --no-cache tzdataRevisions (0)
No revisions yet.