I'm using google-rfc-2445 to generate repeating events according to according to rfc-2445:
The "DTSTART" property for a "VEVENT" specifies the inclusive start of the event. For recurring events, it also specifies the very first instance in the recurrence set.
So, for example RRULE for event which occures every Friday 5 times:
DTSTART;TZID=US-Eastern:20160204T090000
RRULE:FREQ=WEEKLY;COUNT=5;BYDAY=FR;INTERVAL=1;
So according to rfc-2445 it will generate 6 events. First event on Thursday 4 February 2016
, second event on Friday 5 February 2016
, and so on.
How can I achieve that it will exclude first event if it isn't in a pattern? In the example above it should exclude first occurrence, 4 February 2016
. In case of defining DTSTART;TZID=US-Eastern:20160205T090000
which is Friday it should leave first occurrence.
Can it be done by defining such "exclusion rule" in RRULE
itself or I need to make a check in a code and if DTSTART
isn't the same day as defined in BYDAY
I should look for closest date in code (manually) and change DTSTART
accordingly?
UPDATE Ok, according to rfc-2445 and this question on google group: https://groups.google.com/forum/#!topic/google-rfc-2445/xqYFe411ysA
The "EXDATE" property can be used to exclude the value specified in
"DTSTART". However, in such cases the original "DTSTART" date MUST
still be maintained by the calendaring and scheduling system because
the original "DTSTART" value has inherent usage dependencies by other properties such as the "RECURRENCE-ID".
it looks that I need to use EXDATE
property to achieve what do I need. Trying to achieve this by following RRULE:
EXDATE;TZID=Asia/Jerusalem:20160210T000000
RRULE:FREQ=WEEKLY;COUNT=5;BYDAY=WE;INTERVAL=1;
And start date is: 2016-02-10T00:00:00.000+02:00
in the following code:
DateTimeIterable dti = DateTimeIteratorFactory.createDateTimeIterable(RRULE, DTSTART, dateTimeZone, true);
But it returns only 4 events, so it always remove first event.
COUNT=5
. DTSTART counts as the first instance, so there will be only 4 Friday events. – MartenThe COUNT rule part defines the number of occurrences at which to range-bound the recurrence. The "DTSTART" property value always counts as the first occurrence.
– MartenEXDATE
is not a solution. Unless you have support for that in your recurrence library it's not trivial to determine ifDTSTART
matches the rule or not. Given that most implementations returnDTSTART
as the first instance, why do you want to handle it differently? – Marten