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

Update and stick to using moment-timezone to fix DST #8853

Merged
merged 3 commits into from Jun 28, 2023

Conversation

Leslie-Wong-H
Copy link
Member

Fixes #8690

Short description of what this resolves:

Fix the critical CET(Central European Time)/CEST(Central European Summer Time) issue, DST(Daylight Saving Time) related.

Reasoning:
The said behavior illustrated in issue #8690 is most likely caused by the version conflict of moment.js.
First principle thinking, the time zone database IANA is updated periodically, and the author of moment-timezone keeps track of it and releases. So the first step is to update moment-timezone to receive the latest IANA support.
Then, according to his's words, the wrong way to import moment-timezone will very likely cause multiple versions of moment loaded, leading to conflict. And he suggests checking the status of moment.js by running yarn why moment. Here it is,
image

In our case, the usage of moment

import moment from 'moment' 

moment.tz()

occurs many times. However, the imported moment in this way does not ensure the right tz. By refactoring all of such usages to import moment from moment-timezone, the eureka moment arouses. March 26 2023 is the beginning of CEST. Comparison:
March 25 2023,
1
2
3
4
March 26 2023,
-5
-6
-7
-8

Bingo!

No need to consider js/temporal. The journey to dig into the world time zone domain really impresses this commiter significantly.

Changes proposed in this pull request:

  • update moment-timezone
  • stick to using moment-timezone to load moment all over the places

Checklist

  • [*] I have read the Contribution & Best practices Guide.
  • [*] My branch is up-to-date with the Upstream development branch.
  • [*] The acceptance, integration, unit tests and linter pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@vercel
Copy link

vercel bot commented Jun 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
open-event-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 28, 2023 4:30am

@cweitat cweitat merged commit 9ad5e98 into fossasia:development Jun 28, 2023
9 checks passed
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

Successfully merging this pull request may close these issues.

Timezone issues after change of winter to summer time in Europe
2 participants