Subject: Recurrence implementation question

From: "David King" <[email-masked]>
Date: Fri, 25 May 2001 14:57:53 -0400

I'm trying to think through an implementation of recurrence so I'm
discussing this at a high level rather than actual code.  Repeating events
are my only concern right now and the datasource doesn't matter.

Viewing the month of May for a single user of a calendar app.  I need to
know what events occur during May for this user.  I grab all the user's
repeating events from the past and the month of May.  For each event,
generate a recurrence set that includes all the recurrence dates of the
event from the event's start date to the end of May using the recurrence
rules.  Return the dates that occur during May from the recurrence set.

Issue 1:
After using the calendar for a while, a user might have a large number of
recurring events in the system.  As a result, it will take longer and longer
to figure out if a recurring event occurs within a specified time frame.

Issue 2:
It's necessary to calculate all the recurrence dates that occur between the
event's start date and the specified time frame's start date even though
they are not needed.

Am I moving in the right direction?  Are the issues I've brought up
unavoidable when calculating recurrence?  It appears that a beefy machine
would be needed to run any calendaring app that gets heavily used.  Any tips
from others on the subject?

Thanks for _any_ insights you can provide,
-David King

---

From: Damon Chaplin <[email-masked]>
Date: Mon, 28 May 2001 15:55:29 -0400

> from others on the subject?

You can avoid calculating all the recurrence dates.

You can use the recurrence interval (YEARLY/MONTHLY etc.) and the frequency
to skip events before the period you are interested in.

As an aside, writing the recurrence expansion code is extremely difficult.
I made several errors when implementing it, and I recently realized that
my code doesn't handle timezone changes (e.g. switching to daylight saving
time.)

I think iCalendar really needs to include an algorithm for expanding
recurrences, or we'll all be making the same mistakes.

Damon

---

From: Jonathan Lennox <[email-masked]>
Date: Tue, 29 May 2001 13:31:21 -0400 (EDT)

> event's start date and the specified time frame's start date even though

This is only true if a recurrence has a COUNT parameter, and it's easy
enough to do a one-time translation of COUNT into a "virtual" UNTIL.

BYSETPOS needs to calculate all the dates from the beginning of the set
(enclosing FREQ unit) until the specified range.

Everything else can be computed using my "candidate start time" algorithm,
which should be pretty efficient for non-pathological recurrences.  See
earlier mail I've sent to this list.

-- 
Jonathan Lennox
[email-masked]