I've started sketching out DateTime::Event - a module that would 
represent a single, err, event.

It's based on my experiences with the Palm Calendar, Google Calendar and 
the iCalendar standard.

Eventually it's my hope that there'd would be numerous implementations 
of DateTime::Event::Provider classes such as ones for the providers 
mentioned above, national holidays mayabe even Exchange when I get round 
to wrapping the OpenChange MAPI libraries.

In addition there would probably be two special ::Provider classes - 
::Cache which would, err, cache things (caching implementations would 
themselves be plugins) and Aggregator (which would take a number of 
other providers an aggregate them all).

This is my thinking so far (all names of classes and methods are open 
for discussion).

* new 

I'm unsure as to what to have as the minimum arguments here. I'm 
thinking start and end (both DateTime objects) and title.

A UID can be passed in or automatically generated.

* start and end

Return the start and end time of this event.

The problem we have here is that for one off events start and end are 
definite points in time. For recurring events this merely represents the 
earliest and latest instances of this event (which may both be 
infinite).

* duration

For one off events this is end-start  but for recurring events it won't 
be. In fact it may not be set at all since different occurrences of a 
recurring event may have different lengths.

* all_day vs floating

An all day event takes up, well, all day like blocking out your holiday 
on a calendar.

A floating event takes up all day but doesn't take up any time (such as 
a birthday)

It's possible that the concept of an all day event is irrelevant.


* explode(<time period>)

Splits an event up into n smaller DateTime::Events of <time period> 
long. might be useful for multiday events when split up using days.

* recurrences(<time span>, [time period])

Return all recurrences of the event within that time span as 
DateTime::Events, optionally exploded.

* instances()

A recurring event can have an array of instances attached to it. These 
may provide additional information so that, for example, the 25th of 
December jhas the title Christmas but on the 25th of Decemeber 2007 the 
description will read "Holidaying in the Bahamas".

Thoughts? Comments?

Simon









Reply via email to