3
votes

I've built an iCal feed that works perfectly in Apple's Calendar. Then I tried importing it into Google Calendar and the times are all five hours off, which makes sense because I'm in the US/Eastern timezone. I had assumed from the ical specs that the calendar program should respect my times as local times, bases on how they're formatted (they don't have timezone or UTC tags), but that's not happening. So, I added time zone information to the calendar.

BEGIN:VCALENDAR 
CALSCALE:GREGORIAN 
METHOD:PUBLISH 
PRODID:iCalendar-Ruby VERSION:2.0 
BEGIN:VTIMEZONE 
TZID:America/New_York 
BEGIN:DAYLIGHT 
DTSTART:19700308T020000 
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU 
TZNAME:EDT 
TZOFFSETFROM:-0500 
TZOFFSETTO:-0400 
END:DAYLIGHT 
BEGIN:STANDARD 
DTSTART:19701101T020000 
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU 
TZNAME:EST 
TZOFFSETFROM:-0400 
TZOFFSETTO:-0500 
END:STANDARD 
END:VTIMEZONE

I deleted an reimported the calendar, and the times are still off. A standard event looks like this:

BEGIN:VEVENT 
DESCRIPTION:Justin M. is scheduled to work from 12 PM to 3 PM. 
DTEND:20111103T150000 
DTSTAMP:20111122T144545 
DTSTART:20111103T120000 
LOCATION:Museum of Unnatural History 
SEQUENCE:0 
SUMMARY:Justin M. 
UID:2011-11-22T14:45:45+00:00_239255930@0a9a698e-854d-48e2-97d4-37ff0b28311 9 
END:VEVENT

So, I'm not sure why Google calendar is having trouble. Is it maybe just caching the URL and not really updating the calendar? Is there something else I should doing.

2
Google calendar indeed caches the URLs for some time period - many people have been complaining that manual refresh is a needed feature (for years now).Dave Foster

2 Answers

3
votes

You can specify a specific time zone in each event date, e.g.

DTSTART;TZID=America/New_York:20150218T133000

That way Daylight Time will be taken into consideration automatically and you don't have to convert from local times to UTC (Z) format when creating the calendar. Note you can also run into time zone issues if the client that interprets the ical file doesn't have its zone setting right.

2
votes

So, I resorted to using UTC times by adding a Z to the end of each event time. Coupled with the Time Zone information in the calendar, Google is correctly converting the times -- except for daylight time. Those are still off. Will update if I can figure out why.