Skip to content

Instantly share code, notes, and snippets.

@florisvanvugt
Last active March 15, 2024 22:03
Show Gist options
  • Save florisvanvugt/b6ef1c67f98c20944ec3c9ebd7da76d4 to your computer and use it in GitHub Desktop.
Save florisvanvugt/b6ef1c67f98c20944ec3c9ebd7da76d4 to your computer and use it in GitHub Desktop.

Summary

Starting in March 2024, my Outlook calendar ICS export failed to include a time zone definition. This caused the times to show up wrong when I import the ICS into Google Calendar. I managed to correct this by changing the time zone definition, which can be done automatically using scripts.

Problem statement

I import my Outlook calendar in Google Calendar. The way this works is that Outlook generates an ICS file, which can be accessed via a URL, and which is updated each time I add or change appointments in Outlook calendar. This ICS URL can be imported automatically in Google Calendar so that my Outlook appointments appear in Google Calendar. However, recently, the Outlook appointments started appearing at the correct date but wrong time in Google Calendar. An appointment for 15 March 2024 10 AM would actually show up in Google Calendar as 15 March 2024 7 AM (!). This made it pretty unusable.

Diagnosis

I'm not an expert on calendars and the ICS standard but I think the problem is the following. In the ICS format, each appointment is listed with a time and date in a given time zone, for example 13:30 in Eastern Standard Time. This is done with this kind of syntax:

# DTSTART;TZID=Eastern Standard Time:20230323T133000
# DTEND;TZID=Eastern Standard Time:20230323T160000

The time zone (Eastern Standard Time in this case) needs to be defined in the beginning of the ICS format, so that we know its timing relative to say UTC. The core problem is that in the ICS exported by Outlook this time zone is never defined. "Eastern Standard Time" is used in event start and end times, but it is not defined in the header. Hence, Google Calendar is confused, does not know what time zone a particular event refers to and reverts to a default of some sort.

Solution

In my case I found that although "Eastern Standard Time" was not defined in the ICS header, "Customized Time Zone" /is/ defined and corresponds to Eastern Standard Time. So my solution was to replace each occurrence of "Eastern Standard Time" with "Customized Time Zone". I confirm this worked in my case.

The only painful bit is that I need a script running on my computer to make the conversion. Like so:

curl -s "<OUTLOOK_ICS_URL>" > outlook.ics

# Replace Eastern Standard Time (the time zone that is not defined) with Customized Time Zone which is actually defined and corresponds to Eastern Standard Time from what I can tell.
sed -i 's/TZID=Eastern Standard Time/TZID=Customized Time Zone/g' outlook.ics

# Upload the ics to some server you have access to so that you can synchronize it with Google Calendar 

This is obviously an ugly workaround. The real solution would be if Outlook developers correct their ICS output to conform to the standards.

Hope this helps some souls experiencing the same issue as me!

References

Identical or closely related problems:

Definition standards of ICS:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment