Skip to content

UTCDate calculations are not correct when dealing with DST - incorrect 1 hour offset #12

Open
@cheryllaird

Description

@cheryllaird

I am trying to do some date manipulation on UTCDates, without having timezones get in the way. However when doing calculations that span over DST periods, I am finding the output has a 1 hour offset due to DST.

Starting UTC date:
2025-03-30T00:59:00.000Z
Action:
Adding 1 year (European timezone)
Expected result:
2026-03-30T00:59:00.000Z
Actual result:
2026-03-29T23:59:00.000Z


Starting UTC date
2025-03-30T00:59:00.000Z
Action:
Adding 3 months (Australian timezone)
Expected result:
2025-06-30T00:59:00.000Z
Actual result:
2025-06-30T01:59:00.000Z

Codepen reference:
https://codepen.io/cheryllaird/pen/azojbxX?editors=1010

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions