-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
"Repeat every X weeks" is broken in certain time zones #408
Labels
bug
Something is not working
Comments
tom93
added
bug
Something is not working
needs triage
Issue is not yet ready for PR authors to take up
labels
Jan 4, 2025
tom93
added a commit
to tom93/Calendar
that referenced
this issue
Jan 4, 2025
The previous implementation was broken on some time zones (see FossifyOrg#408 for details). The new implementation hard-codes the start of the week to be Monday to match the previous behaviour. Ideally this should be configurable (see the TODO comment for more notes). Fixes FossifyOrg#408.
4 tasks
tom93
added a commit
to tom93/Calendar
that referenced
this issue
Jan 4, 2025
The previous implementation was broken in some time zones (see FossifyOrg#408 for details). The new implementation hard-codes the start of the week to be Monday to match the previous behaviour. Ideally this should be configurable (see the TODO comment for more notes). Fixes FossifyOrg#408.
tom93
added a commit
to tom93/Calendar
that referenced
this issue
Jan 16, 2025
The previous implementation was broken in some time zones (see FossifyOrg#408 for details). The new implementation hard-codes the start of the week to be Monday to match the previous behaviour. Ideally this should be configurable (see the TODO comment for more notes). Fixes FossifyOrg#408.
tom93
added a commit
to tom93/Calendar
that referenced
this issue
Jan 18, 2025
The previous implementation was broken in some time zones (see FossifyOrg#408 for details). The new implementation hard-codes the start of the week to be Monday to match the previous behaviour. Ideally this should be configurable (see the comments in the code for more notes). Fixes FossifyOrg#408.
tom93
added a commit
to tom93/Calendar
that referenced
this issue
Jan 18, 2025
The previous implementation was broken in some time zones (see FossifyOrg#408 for details). The new implementation hard-codes the start of the week to be Monday to match the previous behaviour. Ideally this should be configurable (see the comments in the code for more notes). Fixes FossifyOrg#408.
tom93
added a commit
to tom93/Calendar
that referenced
this issue
Jan 18, 2025
The previous implementation was broken in some time zones (see FossifyOrg#408 for details). The new implementation hard-codes the start of the week to be Monday to match the previous behaviour. Ideally this should be configurable (see the comments in the code for more notes). Fixes FossifyOrg#408.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Proposed fix: #409
Checklist
Affected app version
1.1.0
Affected Android/Custom ROM version
Android 14
Affected device model
Emulator
How did you install the app?
GitHub releases
Steps to reproduce the bug
Expected behavior
The occurrences should be:
Mon 11 Mar 2024
Mon 01 Apr 2024
Mon 22 Apr 2024
Mon 13 May 2024
Actual behavior
The occurrences are:
Mon 11 Mar 2024
Mon 01 Apr 2024
Mon 15 Apr 2024 (incorrect -- gap is 2 weeks instead of 3)
Mon 06 May 2024
Screenshots/Screen recordings
Observe how in the final screenshot (April) the occurrences are incorrect.
Analysis
The bug is in the method isOnProperWeek in models/Event.k.
It calculates the week number of a timestamp by taking the start-of-day (in the default time zone) as a Unix timestamp then dividing by 7 weeks and rounding to the nearest integer. This works in most cases, but is actually wrong. It mostly works because:
However, this breaks in time zones such as Antarctica/McMurdo, because in that time zone the start-of-day of Monday is very close to Sunday 12:00 UTC, so the rounding is unstable, and daylight saving causes the calculation to produce an incorrect week number.
The text was updated successfully, but these errors were encountered: