Reinhold Kainhofer | 3 Jun 2005 17:47
Favicon
Gravatar

Re: Questions regarding recurrence rules

Hello guys,
I did some more digging in various mailing list archives, re-read rfc 2445 a 
few times and throught a little more on the issues.

On Tuesday 31 May 2005 15:59, Reinhold Kainhofer wrote:
> 2) In Section 4.3.10 RFC 2445 says "The COUNT rule part defines the number
> of occurrences at which to range-bound the recurrence. The "DTSTART"
> property value, if specified, counts as the first occurrence.". 
[...]
> Now if the DTSTART is not specified the quote from above would imply that
> the start doesn't count as a recurrence, so looking at
> DTEND;TZID=whatever:20050530T150000
> DURATION:PT3H
> RRULE:FREQ=WEEKLY;COUNT=3;BYMONTH=6
> would give the following resulting recurrence dates?
>   1) 20050530 (DTSTART is always the first occurence, )
>   2) 20050630
>   3) 20060630
>   4) 20070630 (DTSTART doesn't count towards COUNT)

I thought about this issue some more, and I tend to think that the phrase "if 
specified" in the RFC 2445 is actually meant to mean "if the DTSTART matches 
the recurrence rule" (not if the DTSTART is present in the VEVENT at all). In 
particular this would mean that
  DTSTART;VALUE=DATE:20050603
  RRULE:FREQ=WEEKLY;BYDAY=MO,WE;COUNT=3
gives the recurrence set June 3 (DTSTART), June 6, 8, and 13 (the first three 
occurences defined by the RRULE).

Also, in the rule
  DTSTART;VALUE=DATE:20050603
  RRULE:FREQ=WEEKLY;BYDAY=WE,FR;COUNT=3
the recurrence set is generated by the DTSTART plus the first three occurences 
of the RRULE (June 3, 8 and 10). As a result the recurrence set would only be 
June 3, 8, and 10 (June 3 is duplicate from the DTSTART and the RRULE, but 
rfc 2445 says that means it only appears once).

> 3) About the DTSTART and recurrence rules: Is the DTSTART always taken to
> match the rule (even if it doesn't fulfil the BY* parts)? In particular
> this is important for EXRULES: Is the DTSTART always the first occurence of
> the EXRULE? If that's the case, the DTSTART will always be excluded as soon
> as at least one EXRULE is present.
> And since exceptions overrule inclusions, there's no way to have an
> occurence on the DTSTART in that case... Is this really the intended
> behaviour?

After re-reading the rfc several times, and reading a thread on the libical 
mailing list from July 2002 
(http://www.softwarestudio.org/mail-archives/libical/0680.html, see the 
thread following this initial mail for the relvant comments), I don't think 
that the DTSTART is meant to be automatically part of the recurrence set 
generated by the RRULE (only if it matches the BY* parts). So, basically, 
this means that 
  DTSTART;VALUE=DATE:20050603
  RRULE:FREQ=DAILY
  EXRULE:FREQ=WEEKLY;BYDAY=MO,WE;COUNT=3
excludes only Mo June 6, We June 8, and Mo June 13 (the count applies only to 
the nr of dates that actually match the rule, as explained above; and the 
DTSTART is not automatically excluded by the EXRULE, since otherwise the 
phrase "can be used to exclude ... DTSTART" doesn't make sense).

Can anyone confirm this?

Cheers,
Reinhold

--

-- 
------------------------------------------------------------------
Reinhold Kainhofer, Vienna University of Technology, Austria
email: reinhold <at> kainhofer.com, http://reinhold.kainhofer.com/
 * Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at/
 * K Desktop Environment, http://www.kde.org, KOrganizer / KPilot maintainer

Gmane