The Bitter Pill

50,000 watts of power … Got my radio on

A jQuery hcal parser

For quite some time now I’ve been using js-hcalendar on a few different sites to parse out hcal-formatted events.

While I think it’s a fine script I kept running into limitations with it, so I started hacking and came up with my own.

It’s obviously based on the fine work in js-hcalendar, with a few extra niceties:

  • It supports dtend, and multi-day events
  • It highlights weekends
  • It’s written using jQuery, which allowed quite a bit of simplification
  • You can pass both the event description as well as summary and time
  • It supports pretty month names instead of just a number

As with js-hcalendar, you can have small or large calendars, or switch between them.

So, here ’tis:
jqueryhcal.js

And a short sample css file:
jqueryhcal.css

For those who have no idea what I’m talking about, the hcalendar microformat is a method for “embedding semantic calendaring data in XHTML”.

In other words, a properly formatted event will be understandable for humans reading your page as well as completely machine-parsable. It can also be synced up with iCalendar-compatible calendar programs. Sweet stuff.

Update 7.13.07: Found and fixed a bug that was showing events on their wrong days.

Comments are closed.