Skip to content

date: EDT/PDT give wrong offset when used outside their DST season #10805

@yachi

Description

@yachi

EDT means UTC-4 always, but Rust uses UTC-5 when the date falls in winter:

$ TZ=UTC ./target/debug/date -u -d "2026-01-15 10:00 EDT" "+%F %T %Z"
2026-01-15 15:00:00 UTC
$ TZ=UTC gdate -u -d "2026-01-15 10:00 EDT" "+%F %T %Z"
2026-01-15 14:00:00 UTC

Same with PST in summer (gives UTC-7 instead of UTC-8):

$ TZ=UTC ./target/debug/date -u -d "2026-06-15 10:00 PST" "+%F %T %Z"
2026-06-15 17:00:00 UTC
$ TZ=UTC gdate -u -d "2026-06-15 10:00 PST" "+%F %T %Z"
2026-06-15 18:00:00 UTC

Affects EDT/PDT/CDT/MDT.

Potential root cause: try_parse_with_abbreviation maps EDT → America/New_York, then dt.to_zoned(tz) uses the zone's current offset for that date (EST/UTC-5 in winter) instead of the fixed offset EDT implies (UTC-4).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions