Skip to content

Fix DST offset applied incorrectly near daylight saving transitions#2357

Merged
lahma merged 1 commit into
sebastienros:mainfrom
lahma:fix-dst
Mar 24, 2026
Merged

Fix DST offset applied incorrectly near daylight saving transitions#2357
lahma merged 1 commit into
sebastienros:mainfrom
lahma:fix-dst

Conversation

@lahma

@lahma lahma commented Mar 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes Daylight Savings Time applied incorrectly in Jint #2355
  • The Utc() method in DatePrototype treated local time as a UTC instant when querying GetUtcOffset, causing the wrong DST offset to be used near daylight saving transitions (e.g., midnight in NZ timezone on DST transition days)
  • Changed to a two-pass approach matching the ES spec's UTC(t): estimate UTC first, then get the correct offset at that UTC instant
  • Applied the same fix in DefaultTimeSystem.TryParse for date strings parsed without timezone info

Test plan

  • Added DstTransitionShouldUseCorrectOffset test covering NZ fall-back (April) and spring-forward (September) transitions
  • All 29 Date tests pass
  • Full Jint.Tests suite passes (2781 passed, 0 failures)
  • Test262 conformance suite passes (95,988 passed, 0 failures)

🤖 Generated with Claude Code

…ebastienros#2355)

The Utc() method treated local time as a UTC instant when querying
GetUtcOffset, causing the wrong DST offset near transitions. Use a
two-pass approach matching the ES spec: estimate UTC first, then refine
with the correct offset at that UTC instant. Same fix in TryParse for
date strings without timezone info.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@lahma
lahma enabled auto-merge (squash) March 24, 2026 04:44
@lahma
lahma merged commit f8f9e8a into sebastienros:main Mar 24, 2026
4 checks passed
@lahma
lahma deleted the fix-dst branch March 24, 2026 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Daylight Savings Time applied incorrectly in Jint

1 participant