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

Dailight saving time: fix Atlantic/Azores tz issue with getStartOf fn call #338

Merged
merged 2 commits into from
Mar 13, 2024

Conversation

Gnito
Copy link
Contributor

@Gnito Gnito commented Mar 12, 2024

EditListingAvailbilityExceptionForm: the call for getStartOf function with unit 'day' creates an infinite loop.

The underlying issue is that the Moment library returns a bad time as the start of the day:
moment/moment-timezone#409

If we look for the start of the day on 'Atlantic/Azores' time zone, Moment returns 23:00 hours (March 30) because of DST (since 00:00 does not exist for Azores). There are a couple of other time zones that work like this too.

Most time zones use 03:00 to avoid this issue with DST.
The fix (for the infinite loop) is to add the 1-day offset as before + X hours more and then ask for startOf 'day' (or week/month). After that, the startOf then returns 01:00 (March 31) aka the actual start of the day.

@Gnito Gnito force-pushed the fix-tz-azores-on-DST branch from e7ffef2 to 4d068b3 Compare March 12, 2024 15:59
@Gnito Gnito changed the title Fix tz azores on dst Dailight saving time: fix Atlantic/Azores tz issue with getStartOf fn call Mar 12, 2024
@Gnito Gnito force-pushed the fix-tz-azores-on-DST branch from 4d068b3 to af1ccc4 Compare March 12, 2024 16:16
src/util/dates.js Outdated Show resolved Hide resolved
@Gnito Gnito force-pushed the fix-tz-azores-on-DST branch from af1ccc4 to 4fb3f80 Compare March 13, 2024 09:01
@Gnito Gnito force-pushed the fix-tz-azores-on-DST branch from 4fb3f80 to 9d8af33 Compare March 13, 2024 09:38
@Gnito Gnito merged commit b74d013 into main Mar 13, 2024
3 checks passed
@Gnito Gnito deleted the fix-tz-azores-on-DST branch March 13, 2024 09:47
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.

2 participants