Skip to content

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

Open
@EthanMcQ-TMF

Description

@EthanMcQ-TMF

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions