Skip to content

subtract(years) causes incorrect date when crossing historical timezone change in Malaysia #3137

@liangpishu

Description

@liangpishu

Describe the bug
When parsing a date in 2081 and subtracting 100 years to get a date in 1981, the resulting date is incorrect (shifts from Dec 25 to Dec 1, a 24-day difference). This only happens in Malaysia timezone and appears to be related to Malaysia's historical timezone change on December 31, 1981 (UTC+7:30 → UTC+8:00).

Expected behavior
After subtract(100, "years"), the date should be 1981-12-25 (same day and month as the original date).

Information

  • dayjs version: 1.11.19
  • Plugins: customParseFormat, utc, timezone
  • Timezone: Asia/Kuala_Lumpur (UTC+8, but was UTC+7:30 before Jan 1, 1982)
  • Node.js version:v20.19.3
  • OS: macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions