Subject: [Ietf-calsify] Issue 13: confusion in DTSTART text about "if specified" and BY rules

From: bernard.desruisseaux at oracle.com (Bernard Desruisseaux)
Date: Tue Oct 10 08:36:48 2006

[ This issue was brought up by Reinhold on the ietf-calendar mailing list. ]

In section 4.3.10 Recurrence Rule of RFC 2445 it 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.

I would like to remove "if specified" given that DTSTART should be
REQUIRED when either RRULE or EXRULE are present.

NEW TEXT:

 > The COUNT rule part defines the number of occurrences at which to
 > range-bound the recurrence. The "DTSTART" property value counts as
 > the first occurrence.

Cheers,
Bernard

---

From: reinhold at kainhofer.com (Reinhold Kainhofer)
Date: Tue Oct 10 08:50:10 2006

>  > range-bound the recurrence. The "DTSTART" property value counts as

I don't think that this is what was intended. 
E.g. imagine an event with 

DTSTART;VALUE=DATE:20061010
RRULE:FREQ=WEEKLY;COUNT=2;BYDAY=MO

This event will recur on October 10 and on the next two mondays (Oct 16 and 
23). With your proposed change, it will only occur on October 10 and on the 
next monday (Oct 16), which I would find quite counter-intuitive.

If the DTSTART mathes the RRULE, there is no difference (as the DTSTART in 
that case also counts towards the COUNT):

DTSTART;VALUE=DATE:20061010
RRULE:FREQ=WEEKLY;COUNT=2;BYDAY=TU

This will result in the event occuring on Oct 10 and 17. The "if specified" 
(in the sense "if it matches the RRULE") in the rfc is meant to clarify that 
the RRULE does not add Oct 17 and 24, but rather Oct 10 and 17.

Cheers,
Reinhold
- -- 
- ------------------------------------------------------------------
Reinhold Kainhofer, Vienna University of Technology, Austria
email: [email-masked], http://reinhold.kainhofer.com/
 * Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at/
 * K Desktop Environment, http://www.kde.org, KOrganizer maintainer
 * Chorvereinigung "Jung-Wien", http://www.jung-wien.at/

---

From: andrew_dowden at softdesign.net.nz (Andrew N Dowden)
Date: Thu Oct 12 16:31:29 2006

> the RRULE does not add Oct 17 and 24, but rather Oct 10 and 17.
I strongly agree with your "if it matches the RRULE", but extended to
the recurrence set derived from all RDATE, RRULE, EXDATE, and EXRULE
properties.

suggestion:
  change "if specified," to "if within the recurrence set, then"

new text:
      The COUNT rule part defines the number of occurrences at which to
      range-bound the recurrence.  The "DTSTART" property value, if
      within the recurrence set, then counts as the first occurrence.

Summary:
The means DTSTART is not automatically taken as the first occurrence
(and does
not always count towards COUNT).  This wont immediately effect those
applications that try to avoid DTSTART varying from RRULE, and better
supports COUNT as relates to BYxxx (eg. BYDAY) elements.

Simply including or excluding DTSTART from COUNT does not provide any
certainty of results against an unskilled users expectations.  This is
also an area where the apparent ambiguity of  rfc2445  has resulted in
partial and varied implementations to date.

further background arguments, see my previous posting 12-Oct-2006
04:12pm (+1300)

examples: (from other postings)

(1.) Reinhold Kainhofer - 'next 2 Mondays, on/after 20061010'

  [RESULT: Oct16 Mon, Oct23 Mon]

(2.) Reinhold Kainhofer - 'next 2 Tuesdays, on/after 20061010'

  [RESULT: Oct10 Tue, Oct17 Tue]

(3.) Cyrus Daboo - 'next Monday + next Friday, on/after 20061011'

  DTSTART;VALUE=DATE:20061011
  RRULE:FREQ=WEEKLY;COUNT=1;BYDAY=MO
  RRULE:FREQ=WEEKLY;COUNT=1;BYDAY=FR

  [RESULT: Oct13 Fri, Oct16 Mon]

(4.) Reinhold Kainhofer - 'next 3, Tuesday OR Thursday, on/after 20061009'

  RRULE:FREQ=WEEKLY;COUNT=3;BYDAY=TU,TH
  DTSTART;VALUE=DATE:20061009

  [RESULT: Oct10 Tue, Oct12 Thu, Oct17 Tue]

-- 
_______________________________________________

  SoftDesign Group
  Dowden Software Associates
  P O Box 31 132, Lower Hutt 5040, NEW ZEALAND

---

From: reinhold at kainhofer.com (Reinhold Kainhofer)
Date: Fri Oct 13 01:11:43 2006

>       within the recurrence set, then counts as the first occurrence.

Actually, this introduces a cross-dependency between EXDATE/EXRULE and RRULE! 
E.g. Take a rule
  DTSTART;VALUE=DATE:20061013
  RRULE:FREQ=WEEKLY;COUNT=3
This would last until Oct 27.
Now add one simple EXDATE to exclude DTSTART:
  DTSTART;VALUE=DATE:20061013
  RRULE:FREQ=WEEKLY;COUNT=3
  EXDATE;VALUE=DATE:20061013
With your suggestion the RRULE would now last until Nov 3. 
Compare this with an EXDATE for the next friday:
  DTSTART;VALUE=DATE:20061013
  RRULE:FREQ=WEEKLY;COUNT=3
  EXDATE;VALUE=20061020
This event lasts only until Oct 27. Quite inconsistent, don't you think?

As the recurrence set is evaluated in the order 
1) DTSTART
2) Add all date/times from RDATE and RRULE
3) Exclude all date/times from EXDATE and EXRULE
the evaluation of 2) now depends on 3) !

> The means DTSTART is not automatically taken as the first occurrence

It would be, unless DTSTART is EXCLUDED by EXDATE or EXRULE.

>   [RESULT: Oct13 Fri, Oct16 Mon]

You forgot to include DTSTART in the recurrence set! 

>   [RESULT: Oct10 Tue, Oct12 Thu, Oct17 Tue]

Here you are missing Oct 9 Mon (DTSTART)! As you count the DTSTART in this 
case towards the COUNT, Oct17 won't be in the recurrence set.

Cheers,
Reinhold

-- 
------------------------------------------------------------------

---

From: lists at block-online.eu (Oliver Block)
Date: Fri Oct 13 03:21:39 2006

Am Freitag, 13. Oktober 2006 10:12 schrieb Reinhold Kainhofer:
> Actually, this introduces a cross-dependency between EXDATE/EXRULE and
> RRULE! E.g. Take a rule

Aren't you supposed to create the set of dates, before you exclude a date?

1 Create a set A from RRULE
2 Add RDATE to the set A (without duplicates)
3 create a set B from EXRULE
4 Add EXDATE to the set B (without duplicates)
5 Add all dates to R (recurrence set) that are in A and not in B (R = A \ B )

Regards,

Oliver

-- 
Leben ist mehr als ... 
http://www.nak-nrw.de/p_6_4.html

---

From: reinhold at kainhofer.com (Reinhold Kainhofer)
Date: Fri Oct 13 03:29:47 2006

> 5 Add all dates to R (recurrence set) that are in A and not in B (R = A \ B

Exactly. But the Andrew's proposal would add a cross dependency of set A on 
set B (as the COUNT of RRULE would depend on whether the DTSTART is in the 
final set R, which means that it is not in B).

Cheers,
Reinhold

- --

---

From: lists at block-online.eu (Oliver Block)
Date: Fri Oct 13 04:25:16 2006

> final set R, which means that it is not in B).

Let's take your example from above:

Interpretation 1 (DTSTART is 1st occurance):
------------------------------------------------------
> > ? DTSTART;VALUE=DATE:20061013
> > ? RRULE:FREQ=WEEKLY;COUNT=3

A = {20061013, 20061020, 20061027}
B = {}
R = A \ B means in this case R = A

> > ? DTSTART;VALUE=DATE:20061013
> > ? RRULE:FREQ=WEEKLY;COUNT=3
> > ? EXDATE;VALUE=DATE:20061013

A = {20061013, 20061020, 20061027}
B = {20061013}
R = A \ B = {20061020, 20061027}

Interpretation 2 (1st occurance is first date generated by RRULE):
--------------------------------------------------------------------------------
> > ? DTSTART;VALUE=DATE:20061013
> > ? RRULE:FREQ=WEEKLY;COUNT=3

A = {20061020, 20061027, 20061103}
B = {}
R = A \ B means in this case R = A

> > ? DTSTART;VALUE=DATE:20061013
> > ? RRULE:FREQ=WEEKLY;COUNT=3
> > ? EXDATE;VALUE=DATE:20061013

A = {20061020, 20061027, 20061103}
B = {20061013}
R = A \ B = {20061020, 20061027, 20061103}

That's how I understand either of the interpretations.

Regards,

Oliver

---

From: reinhold at kainhofer.com (Reinhold Kainhofer)
Date: Fri Oct 13 04:50:26 2006

> Interpretation 1 (DTSTART is 1st occurance):

That's not what Andrews suggested:
      "The COUNT rule part defines the number of occurrences at which to
      range-bound the recurrence.  The "DTSTART" property value, if
      within the recurrence set, then counts as the first occurrence."

Andrew suggested that the date/time of DTSTART only counts towards the COUNT 
if it is in R. As it is not in R, the set A will be {20061013, 20061020, 
20061027, 20061103}, and R={20061020, 20061027, 20061103}. And we have the 
problem that the calculation of A depends on R, which in turn depends on A.

Or is it just a misunderstanding and Andrew didn't want to use "recurrence 
set", which means R in our case, but was rather talking about the set A?

> Interpretation 2 (1st occurance is first date generated by RRULE):

Okay, now it's getting interesting! Why is 20061013 not part of A? The 
examples in section "4.8.5.4 Recurrence Rule" clearly show that it should be.
Similarly, 20061103 should not be part of A.

Notice that in this case the DTSTART matches the RRULE anyway, so we are not 
talking about Issue 13 here! Issue 13 only appears when the DTSTART does not 
fulfil the restrictions of the RRULE, i.e. if DTSTART is a Monday and the 
RRULE has BYDAY=TU,TH.

Cheers,
Reinhold

---

From: lists at block-online.eu (Oliver Block)
Date: Fri Oct 13 06:09:57 2006

Am Freitag, 13. Oktober 2006 13:50 schrieb Reinhold Kainhofer:
> Andrew suggested that the date/time of DTSTART only counts towards the
> COUNT if it is in R. As it is not in R, the set A will be {20061013,
> 20061020, 20061027, 20061103}, and R={20061020, 20061027, 20061103}. And we
> have the problem that the calculation of A depends on R, which in turn
> depends on A.
>

I think so.

> Notice that in this case the DTSTART matches the RRULE anyway, so we are
> not talking about Issue 13 here! Issue 13 only appears when the DTSTART
> does not fulfil the restrictions of the RRULE, i.e. if DTSTART is a Monday
> and the RRULE has BYDAY=TU,TH.

ack

Regards,

Oliver

---

From: cyrus at daboo.name (Cyrus Daboo)
Date: Fri Oct 13 06:40:20 2006

Hi Andrew,

> supports COUNT as relates to BYxxx (eg. BYDAY) elements.

I believe this change would 'break' many existing implementations. 
Certainly it seems the majority of currently implementations always 
consider DTSTART as the first instance in COUNT, and I think the spec 
should be clarified to 'bless' that view.

-- 
Cyrus Daboo

---

From: reinhold at kainhofer.com (Reinhold Kainhofer)
Date: Fri Oct 13 08:04:53 2006

> should be clarified to 'bless' that view.

Really? What do you understand as the majority?

So far I have:

DTSTART always first instance in COUNT, even if it does not match the rule:
  -) Apple iCal (at least according to Jeffrey)

DTSTART only first instance in COUNT if it matches the rule:
  -) Google Calendar (Online version as of Oct 12, 2006; checked by RK)
  -) KOrganizer and KAlarm, (all versions; implemented by RK)
  -) Evolution (version 2.6.3; checked by RK)
  -) Mozilla Calendar/Sunbird (version 0.3; checked by RK)
  -) Chandler (version 0.6; checked by RK)

Other behavior (e.g. don't allow such rules at all, give an error, etc.):
  -) Outlook
  -) (e|php)Groupware
  -) Chandler 0.7alpha3 (Ignores the DTSTART altogether if DTSTART does not
      match RRULE!!! DTSTART also not included in COUNT; checked by RK)

I put my results on a wiki page:
http://wiki.kde.org/?page=RFC2445+RRULEs

A sample .ics file to test various implementations is also there.

Cheers,
Reinhold

---

From: cyrus at daboo.name (Cyrus Daboo)
Date: Fri Oct 13 08:23:18 2006

Hi Reinhold,

> Really? What do you understand as the majority?

We'll find out from the survey...

-- 
Cyrus Daboo