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:
Create a monthly scheduled notification for the last day of a 31 day month
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
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.
To Reproduce
Steps to reproduce the behaviour:
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