[ANN] ICal occurrence API

Alan Lovejoy squeak-dev.sourcery at forum-mail.net
Mon May 28 19:21:26 UTC 2007



<JJ (Jason)>
Features:
  - To my knowledge this is the most compliant implementation of Recurrence
rules
  - Full support for Exclusion dates and exclusion rules (!)
</JJ (Jason)>

The next release of Chronos will have full support for recurrence rules
based on the iCal rule model--including exclusion dates and exclusion rules.

The implementation is based on a recurrence rule algebra, so that recurrence
rules can be specified using algegraic expressions, which are then evaluated
according to a recurrence rule algebra.

Example:

(RecurrenceSet from: (2007 month: #February day: 9))
	add:
		(RecurrenceRule
			delta: 1 years count: 10
			temporalExpression: ((WeekOfMonth week: 0) &
(#Sunday asDayOfWeek | #Saturday asDayOfWeek) not)
			occurrenceIndices: #(0)); "Chronos uses 0 as the
ordinal of the last value or element."
	do: [:each | Transcript cr; show: each % #rfc2822]

The iCal expression that specifies the same thing:

  DTSTART;TZID=America/Los_Angeles:2007-02-09
  RRULE:FREQ=YEARLY;COUNT=10;BYDAY=-1MO,-1TU,-1WE,-1TH,-1FR;BYSETPOS=-1

The output:

Wed, 28 Feb 2007
Fri, 29 Feb 2008
Fri, 27 Feb 2009
Fri, 26 Feb 2010
Mon, 28 Feb 2011
Wed, 29 Feb 2012
Thu, 28 Feb 2013
Fri, 28 Feb 2014
Fri, 27 Feb 2015
Mon, 29 Feb 2016

--Alan





More information about the Squeak-dev mailing list