Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The timezone is affected by local DST #2675

Open
yang960701 opened this issue Jun 11, 2024 · 0 comments
Open

The timezone is affected by local DST #2675

yang960701 opened this issue Jun 11, 2024 · 0 comments

Comments

@yang960701
Copy link

Describe the bug

import dayjs from "dayjs";
import utc from "dayjs/plugin/utc";
import timezone from "dayjs/plugin/timezone";
import "dayjs/locale/ja";

    dayjs.extend(utc);
    dayjs.extend(timezone);
    dayjs.tz.setDefault("Asia/Tokyo");

    const d1 = dayjs.tz("2024-03-31 00:00", "Asia/Tokyo");
    const d2 = dayjs.tz("2024-03-31 01:00", "Asia/Tokyo");
    const d3 = dayjs.tz("2024-03-31 02:00", "Asia/Tokyo");
    
    console.log(d1.format("YYYY/MM/DD HH:mm"));
    console.log(d2.format("YYYY/MM/DD HH:mm"));
    console.log(d3.format("YYYY/MM/DD HH:mm"));

When the time zone is set as follows, 1 o'clock is skipped due to the influence of the local time zone.

Expected behavior
2024/03/31 00:00
2024/03/31 01:00
2024/03/31 00:00

expect the output result value as above, but the following value comes out.

2024/03/31 00:00
2024/03/31 02:00
2024/03/31 03:00

Information

  • Day.js Version [e.g. v1.11.11]
  • OS: [e.g. window10]
  • Browser [N/A, Node 20.11.1]
  • Time zone: [e.g. Europe/London utc+0]
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

No branches or pull requests

1 participant