As I looked at some cool ideas from Elias Torrez (via James Snell), it occurred to me that I could make some homebrew sauce for Google Calendar to address one of my wants, namely a meeting time chooser for one or more participants. Here's how it could work.
In the Atom feed for the calendar, there are elements in a Google namespace like so:
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
xmlns:gd="http://schemas.google.com/g/2005">
[...]
<entry>
[...]
<gd:when startTime="2006-04-03T16:00:00.000Z"
endTime="2006-04-03T17:00:00.000Z"/>
</entry>
</feed>
We'd want a query that accepted a tuple of URLs for Atom calendar feeds and performed an iterative merge:
- Copy the
<gd:when> elements from the first feed on the list into working storage of some kind. We'll write a @startTime and @endTime pair as (s,e) in what follows.
- Iterate through the elements of the next feed in the list; suppose that the current one is
(x,y). If there is an element (w,z) in the scratch list such that z<x and w<y, replace (x,y) by (min(x,w),max(y,z)). Otherwise, add (x,y) to the scratch list.
- Repeat #2 with each feed.
As additional sugar, one additional feed could be used to represent desired days or time ranges by exclusion. The combined feed would contain the collective busy times for the group, and the publicly visible Atom feeds for each calendar would be all that would be needed.
This could be done in a browser with a script written in E4X, with the caveat of having to perform date arithmetic. (The XML Schema variant of ISO 8601 date-times compare cleanly as strings, but the JavaScript Date object is based on a different syntax.) XQuery supports operations and comparisons on dateTime and duration values, so it would be another good candidate. As would Ruby, thanks to Atom support and date support in a compatible format.