lib-recur: RecurrenceRuleIterator always returns start date as the first DateTime in the set

Hello!

I have the following rule:

FREQ=MONTHLY;BYDAY=FR;BYMONTH=3,6,9,12;BYSETPOS=-1

The rule describes an event that should occur on last Friday of March, June, September and December. The rule is correct - checked it with various tools.

For the start date of the iterator I set the first day of the 27th week of the year, which is: 07/06/2015. The first date the iterator returns is the start date, which is clearly not the one described by the rule.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

RFC 5545 Section 3.8.5.3 states:

The “DTSTART” property defines the first instance in the recurrence set. The “DTSTART” property value SHOULD be synchronized with the recurrence rule, if specified. The recurrence set generated with a “DTSTART” property value not synchronized with the recurrence rule is undefined.

It basically says “don’t expect anything if the start date doesn’t match the rule”. However, it also says “The “DTSTART” property defines the first instance in the recurrence set”, which is why we’ve chosen this implementation.

We probably can add a parameter to modify this behavior. It’s basically two classes that inject the start instance as the first instance: SanityFilter and FastWeeklIterator.