Skip to content

fix in timezone: ensure UTC chain is not affected by host DST in startOf#3144

Open
EzequielArce wants to merge 1 commit into
iamkun:devfrom
EzequielArce:fix/timezone-utc-startof-day-dst-leak
Open

fix in timezone: ensure UTC chain is not affected by host DST in startOf#3144
EzequielArce wants to merge 1 commit into
iamkun:devfrom
EzequielArce:fix/timezone-utc-startof-day-dst-leak

Conversation

@EzequielArce

@EzequielArce EzequielArce commented Jun 17, 2026

Copy link
Copy Markdown

Description
This PR fixes a bug in the timezone plugin where calling .startOf('day') on a UTC instance returns an incorrect date if the host machine's local time is undergoing a Daylight Saving Time (DST) transition on that specific date.

The Problem
In the original implementation, proto.startOf handles timezone shifting by formatting the date into a naive string (YYYY-MM-DD HH:mm:ss:SSS) and parsing it back using the default factory d().

When the target timezone is UTC but the host system (e.g., America/Los_Angeles) experiences a DST transition (such as a 25-hour day), the core's default parsing falls back to the host's local clock constraints. This causes the underlying local Date mathematics to miscalculate the midnight boundary, leaking the host's DST anomaly into the final UTC object.

Solution presented
When this.$x.$timezone is 'UTC':
I use { utc: true } in the configuration.

Type of Change

  • Change in the plugin timezone.js
  • Added the following test: transitionDSTtoUTC

Addresses #3123

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.

1 participant