A while ago I played around with manually generating iCal feeds for events, encoding the BIDA's regular schedule (1st and 3rd Sundays back then, with a more complex pattern for family dances and open bands) as in a machine-readable format. This was a fun project, but it didn't work very well: it didn't have any way to handle cancellations, special events, or other one-off adjustments to the schedule.

Still, having events automatically show up on calendars is great, and after Jeff Keller asked I decided to put something together.

Here's the feed: bidadance.org/events.ics. You can add it in Google Calendar by going to "Other Calendars" > "+" > "From URL":

And then pasting in the calendar URL:

Here's the next afternoon contra I'm able to attend, showing up on my phone:

For the actual implementation a script reads in the machine-readable list of scheduled events (dances.js). This is a bit more awkward that it could be, since the list is essentially JSONP and not pure JSON, so it needs to do a little hacky parsing. Then it interprets the records and uses the icalendar package to build in iCal file. Dates, times, and libraries can all be a bit tricky when they're an area you don't work in much, and I found Claude to be pretty helpful here.

I also set up a cron job (script) that looks for changes each hour and if so checks them in.

Let me know if you see any problems with it!

New Comment
More from jefftk
Curated and popular this week