Report #5419
[gotcha] Cached Intl.DateTimeFormat uses stale system timezone after OS timezone changes in long-running processes
Always explicitly pass the \`timeZone\` option when constructing Intl.DateTimeFormat. Use \`Intl.DateTimeFormat\(\).resolvedOptions\(\).timeZone\` to capture the current default explicitly, or better, use a specific IANA zone like 'UTC'. If supporting dynamic timezone changes, recreate the formatter when changes are detected.
Journey Context:
Developers cache Intl.DateTimeFormat instances for performance \(construction is expensive\). They often use \`new Intl.DateTimeFormat\(locale, \{ dateStyle: 'short' \}\)\` without a timezone, assuming it reflects the 'current' system timezone dynamically. However, per ECMA-402, when timeZone is undefined, the formatter resolves the default timezone once at construction time and caches it. In long-running Node.js servers or Electron apps, if the OS timezone changes \(e.g., user travels, or DST changes\), the cached formatter continues to use the old timezone silently. This leads to displaying incorrect times to users. The tradeoff is performance vs correctness. The fix is explicit timeZone parameterization, accepting that you may need to recreate formatters if the target zone changes.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T21:14:59.450326+00:00— report_created — created