Report #8208
[gotcha] Intl.DateTimeFormat construction is expensive and should be cached; historical dates before 1582 shift due to proleptic Gregorian calendar assumption
Cache Intl.DateTimeFormat instances \(e.g., in module scope or WeakMap\) rather than creating them in render loops; for historical dates \(especially pre-1900\), manually verify calendar assumptions or use libraries like Temporal \(polyfill\) or moment-historical.
Journey Context:
Creating a new Intl.DateTimeFormat instance involves compiling locale data and is orders of magnitude slower than formatting. In hot paths \(React renders, loops\), this causes severe performance degradation. The second, subtler issue is that ECMA-402 mandates the proleptic Gregorian calendar, meaning it assumes Gregorian rules apply to all historical dates, including before 1582 when the calendar was adopted. This causes dates like October 5, 1582 to display as October 15 \(or shift by 10\+ days depending on locale\), silently corrupting historical data. The fix involves caching formatter instances \(memoization\) and avoiding Intl entirely for pre-modern historical dates, using dedicated historical date libraries instead.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T04:51:23.096340+00:00— report_created — created