rossta/montrose

Monthly recurrences decries days

mikalai-yankouski opened this issue · 1 comments

Hi @rossta, thank you for the awesome and helpful library. I have come across the fact that monthly repetitions reduce the date day.
I tried to build this using a pattern like:
Montrose.every('month').merge({ starts: Time.zone.parse('2020-12-31'), interval: 1, total: 5 }).map(&:to_date)
result:

[Thu, 31 Dec 2020, 
 Sun, 31 Jan 2021, 
 Sun, 28 Feb 2021, 
 Sun, 28 Mar 2021, 
 Wed, 28 Apr 2021]

in this case - I would expect to get the logic that is implemented in month_day: -1
the same with Dec 30 service reduce the date day after Feb 28, but if it I select Dec 30, I would like to get

  #expected                  # service returns
[Wed, 30 Dec 2020,          [Wed, 30 Dec 2020, 
 Sat, 30 Jan 2021,           Sat, 30 Jan 2021, 
 Sun, 28 Feb 2021,           Sun, 28 Feb 2021, 
 Tue, 30 Mar 2021,           Sun, 28 Mar 2021, 
 Fri, 30 Apr 2021]           Wed, 28 Apr 2021]
 



What do you think?

@mikalai-yankouski Thanks for your comment and for providing examples. I'm reluctant to call this a bug since the recurrences you've listed are ambiguous. What if the start date was Feb 28th? Should the March recurrence fall on the 28th or the 31st?

If you're expecting a monthly recurrence to recur on a specific day of the month, then it needs to be specified in the recurrence. Hope that makes sense.