`Recurrence.get_recurrences/2` returns invalid dates after passing leap day once in the recurrence stream
- Dominant language
- Elixir
- Stars
- 106
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
Consider following example
```elixir
%ICalendar.Event{dtstart: ~U[2020-12-30 01:01:01Z], rrule: %{freq: "MONTHLY"}}
|> ICalendar.Recurrence.get_recurrences(~U[2022-01-01 01:01:01Z])
```
The first recurrence is `2021-01-30`
Then, as there is no 30th day in February, `Timex.shift` returns `2021-02-28` (as describe in [docs](https://hexdocs.pm/timex/Timex.html?#shift/2-shifting-and-leap-days))
All recurrences returned from stream after that point to 28th day of a month (for instance, the third one is 2021-03-28), which I believe is invalid.
To reproduce run:
```elixir
ICalendar.Recurrence.get_recurrences(
%ICalendar.Event{dtstart: ~U[2020-12-30 01:01:01Z], rrule: %{freq: "MONTHLY"}},
~U[3000-01-01 01:01:01Z]
)
|> Enum.take(3)
|> IO.inspect()
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at ICalendar.Recurrence.get_recurrences/2 and reproduce the issue with the provided Event, monthly rule, and Enum.take(3) example. Check how Timex.shift handles the February transition; done means later monthly recurrences retain the intended day instead of remaining on the 28th.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elixir
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100