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

"End of month" schedules will break after a short month #295

Open
EthanMcQ-TMF opened this issue Oct 31, 2024 · 2 comments · May be fixed by #296
Open

"End of month" schedules will break after a short month #295

EthanMcQ-TMF opened this issue Oct 31, 2024 · 2 comments · May be fixed by #296
Labels
bug Something isn't working

Comments

@EthanMcQ-TMF
Copy link
Collaborator

Describe the bug

The way we currently calculate the next due date for a monthly schedule will always cause truncation.

Currently we take the start of the schedule and loop through adding months until we reach a date that is beyond the current date. This will always (eventually) cause a schedule at the end of the month to truncate lower.

2024-01-31 + 1 month =>
2024-02-29 + 1 month => // rust::chrono automatically truncates to the smaller month
2024-03-29 // This should be the 31st

To Reproduce

Steps to reproduce the behaviour:

  1. Create a monthly scheduled notification for the last day of a 31 day month
  2. Wait

Expected behaviour

The notification should send on the last day of the month, each month

Additional context

This can also cause issues with "first of the month" schedules if the local timezone is ahead of UTC (e.g. NZT +12/+13) as the schedule will be processed on the server in UTC and this same truncation will happen

@EthanMcQ-TMF EthanMcQ-TMF added the bug Something isn't working label Oct 31, 2024
@EthanMcQ-TMF
Copy link
Collaborator Author

Not picking this up right now but I wrote a quick unit test to show the behaviour and pushed to a branch

@jmbrunskill
Copy link
Collaborator

Nice find!

@EthanMcQ-TMF EthanMcQ-TMF linked a pull request Nov 4, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants