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

fix: The time zone offset is incorrectly calculated when the DST exits at 00:00. #2835

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

xingyixiang
Copy link

@xingyixiang xingyixiang commented Mar 5, 2025

fix: #2834 #2303

@xingyixiang
Copy link
Author

Can you help review the code? Thanks @iamkun

@xingyixiang xingyixiang closed this Mar 7, 2025
@xingyixiang xingyixiang reopened this Mar 11, 2025
@xingyixiang
Copy link
Author

America/Asuncion时区是0点跳变所以会出现这个问题。测试了2024-03-24的夏令时跳变也是有问题的。所以如果是在0点跳变夏令时的都是有问题的这是一个共性问题。

This problem occurs because the America/Asuncion time zone changes from 00:00. Tested 2024-03-24 DST jump is also problematic. Therefore, if the DST is changed at 00:00, it is a common problem.

it('test America/Asuncion', () => {
  const testDate = dayjs('2024-03-24T03:20:57.000+00:00').tz('America/Asuncion').format('YYYY-MM-DD HH:mm:ssZ')
  expect(testDate).toBe('2024-03-23 23:20:57-04:00')
})

Result "2024-03-23 23:20:57-05:00"

@xingyixiang xingyixiang changed the title fix: inaccurate time zone offset during daylight saving time fix: 0:00 jump to daylight saving time, inaccurate calculation of time zone offset Mar 11, 2025
@xingyixiang xingyixiang changed the title fix: 0:00 jump to daylight saving time, inaccurate calculation of time zone offset fix: The time zone offset is incorrectly calculated when the DST exits at 00:00. Mar 11, 2025
@Qiming-Liu
Copy link

Please add test, thanks!

@xingyixiang xingyixiang marked this pull request as draft March 12, 2025 02:44
@xingyixiang xingyixiang marked this pull request as ready for review March 12, 2025 11:10
@xingyixiang
Copy link
Author

npm run test-tz4

Before
1741778142815

After
1741778226650

done @Qiming-Liu

@Qiming-Liu
Copy link

Qiming-Liu commented Mar 13, 2025

Nice work!
Sorry, I am not the contributor of this repo, I can't help review.
But I don't think you shouldn change package.json

@xingyixiang
Copy link
Author

Nice work! Sorry, I am not the contributor of this repo, I can't help review. But I think you shouldn't change package.json

Okay, thank you.
The test case cannot run in the Windows environment. Therefore, some modifications are made.

@Qiming-Liu
Copy link

Yeah, that's fine. Before creating the pull request, you can remove the changes that were made to package.json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants