Working with vCalendar

I couldn’t sleep last night, so I used my time to work on putting Moon phase information for the new year into my Palm’s calendar. I already have a Python script that will calculate the times of the phases of the Moon based on the algorithms found in Jean Meeus’ Astronomical Algorithms (2nd Ed., 1998). But I still needed a way to import this data into my Palm in an automated way. Last year, I did this by hand. Yuck! So I used the Palm Desktop application and the vCalendar file format for exchange of calendaring and scheduling information. I had never used the vCalendar format before, but I found the specifications online and soon modified my Python code to output into this format. Here’s an example of what I produced:

Note that the times DTSTART are given in UTC (the “Z” is for “zulu”), but I wanted the event description to be in local time (8 hours ahead for China). Since China doesn’t observe daylight savings time, I could apply this +8 h correction into the Python code quite trivially.