Internet calendar formats revisited

A few weeks ago, I was com­plain­ing about the lack of a good Open Source library for both pars­ing AND mak­ing use of the vcal/ical inter­net cal­en­dar feed for­mat.  Quite a few solu­tions exist for sim­ple pars­ing but few (okay, zero that I could find) solid, robust solu­tions exist for doing any­thing intel­li­gi­ble with the data once parsed — specif­i­cally, expand­ing out the var­i­ous types of recur­rences and can­cel­ing out occur­rence excep­tions.

Last week, a poten­tial solu­tion just dropped right into my lap.  For some rea­son that I do not remem­ber I was look­ing at Dashcode, Apple’s tool for writ­ing and debug­ging JavaScript-based wid­gets.  It is actu­ally a well-crafted tool, I have just never had a need for it.  It turns out that one of the pre­made appli­ca­tion tem­plates is for dis­play­ing upcom­ing cal­en­dar events from a pub­lished iCal feed.  The parser not not only han­dles one-time events, but repeat­ing ones.  It is writ­ten in JavaScript and makes good use of object-oriented tech­niques, includ­ing objects for the cal­en­dar, event, time­zones, recur­ring rules, and the file parser.  Previously, writ­ing a full parser and cal­en­dar engine was a lit­tle beyond the scope of the project that called for a cal­en­dar feed.  Now, it looks like it might be just a sim­ple trans­la­tion of JavaScript to Objective-C (plus some unit tests to catch pos­si­ble tran­scrip­tion errors).

Posted in: Code

Published by

Brian Enigma

Brian Enigma is a Portlander, manipulator of atoms & bits, minor-league blogger, and all-around great guy. He typically writes about the interesting “maker” projects he's working on, but sometimes veers off into puzzles, software, games, local news, and current events.

Leave a Reply

Your email address will not be published. Required fields are marked *