Open theoks opened 1 month ago
Thank you for finding and reporting this! What is happening is that we use a base recurrence to enumerate the monthly repetition, and then move each date to the fifth Friday of that month. Since we are matching strictly, the base recurrence can skip a few months if we start from the 31st.
I'll look into fixing this in #555, where I am optimizing the way we calculate recurrences.
I tried to use the new
Calendar.Recurrence
objects and functionality, and I've bumped into some surprising (wrong?) output.Given the following date range:
2024-01-01...2024-12-31
, I used the.monthly
recurrence rule to find every 5th Friday in the given range, using thestrict
matching rule.The result was the (correct) following:
Now if I change the lower bound (start date) of the range to
2024-01-31
the result is unexpectedly the following:The
2024-11-29
is missing from the output.Output becomes even stranger if the calendar's
firstWeekday
is changed. IffirstWeekday == 2
, and the lower bound (start day) is2024-01-01
then the output is the following:If the lower bound (start date) is
2024-01-31
then the result is the following.I believe that this is a bug, unless I am missing something in the way the algorithm works.
Some code if someone wants to quickly run some tests: