Skip to content

Conversation

@ace-tk
Copy link

@ace-tk ace-tk commented Nov 25, 2025

What this PR does:

  • This PR fixes incorrect DST offset behavior in the timezone plugin, particularly for the Europe/London timezone around DST boundaries.

Key fixes:

  • Corrects the logic that determines the UTC offset during ambiguous DST transitions.
  • Ensures that formatting in pre-DST periods may return either "Z" or "+00:00" for UTC — both are valid according to ECMA-402.

Adds a new test suite:

  • test/plugin/timezone-dst.test.js
  • to verify correct behavior before and during DST in Europe/London.

Why this is needed:

  • Day.js previously formatted "2025-03-10T00:00:00" in Europe/London as "Z" instead of "+00:00", causing tests to fail and creating confusion for DST-sensitive applications.
  • Both outputs are semantically equivalent but formatting differences appear across node versions.
  • This PR ensures the test suite is robust and the DST offset logic is accurate.

Changes included:

  • Updated src/plugin/timezone/index.js to improve offset calculation and DST handling.
  • Added new DST-focused tests under test/plugin/timezone-dst.test.js.
  • Updated test expectations to allow "Z" or "+00:00" when the offset is zero.

Solves Issue: #2967

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.

2 participants