lib-recur
lib-recur copied to clipboard
Using a DTSTART per rule with RecurrenceSet
I have a list of rrules. Each rrule may have a DTSTART and UNTIL. But it seems that lib-recur RecurrenceSet does not support this, as it is assumed there is only one DTSTART for the set.
How can I use one DTSTART per rule in RecurrenceSet?
How exactly does that look like? Can you post an example?
As explained in Issue 26, DTSTART is not a valid part of an RFC 5545 RRULE.
Merging multiple rules with different DTSTART each, is indeed not a supported use case at this time. What's your particular use case? Maybe we can do something about it.
Thanks for your reply. My use case is determining days when a particular activity (e.g. a departure for a tour) is on offer. For this we have a list of "available" rules, and then a list of "exceptions / exclusion" rules.
For example: Departure every mon-fri over summertime, but only wed-fri over winter. Closed on wednesdays in December. Schedule changes next year, when departure over summer will be mon-sat.
To implement this, I would have: rule 1: every mon-fri, May-Aug UNTIL 1.jan 2017 rule 2: every wed-fri, Sep-Apr exclusion: every wed, Dec rule 3: every mon-sat, May-Aug, DTSTART 1.jan 2017
I allow my users to create a list of rules describing their requirements. Ideally, I would like to add these rules to a set and then get an iterator for a particular interval (e.g. one month at a time in an availability calendar).
So basically, I may have multiple rules, but each one of them may be restricted by DTSTART and UNTIL.
Understood, so we need a way to merge multiple RecurrenceSets into one. This probably needs some refactoring. In particular we should make RecurrenceSet an interface.
I just realized that this was recently implemented by the changes made for #131.