Search code examples
outlookgoogle-calendar-apiicalendar

ICS timezones not converting correctly when importing to Google or Outlook


I've generated ICS file that with events that each start at 9 AM and end in 5 PM Pacific time ( UTC-8 ). When converting to my local time ( GMT+4 ), it should show the events to be 10 PM - 6 AM, instead both Google and Outlook convert it too 8 PM - 4 AM.

I've tried adjusting the TZOFFSETFROM and TZOFFSETTO settings for both daylight and standard, to show correct conversion, but it only has effect on Outlook - Google Calendar seems to completely ignore those settings. However, it seems wrong to me to change the settings for Outlook anyway, since originally they have the correct settings for Pacific Time?

The code for ICS file is attached.

VERSION:2.0
PRODID:-//Foobar Corporation//NONSGML Foobar//EN
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:EnergyPlex
X-WR-TIMEZONE:America/Los_Angeles
BEGIN:VTIMEZONE
TZID:America/Los_Angeles
X-LIC-LOCATION:America/Los_Angeles
BEGIN:DAYLIGHT
TZOFFSETFROM:-0800
TZOFFSETTO:-0700
TZNAME:PDT
DTSTART:19700308T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:-0700
TZOFFSETTO:-0800
TZNAME:PST
DTSTART:19701101T020000
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
UID:20190709T133817-12030501-example.com
DTSTAMP:20190709T133817
DTSTART;TZID=America/Los_Angeles:20190722T090000
DTEND;TZID=America/Los_Angeles:20190722T170000
SUMMARY:Energyplex Day Camp for Jenny Doe
DESCRIPTION: Your child is booked for a camp on this day.
END:VEVENT
BEGIN:VEVENT
UID:20190709T133817-422290764-example.com
DTSTAMP:20190709T133817
DTSTART;TZID=America/Los_Angeles:20190723T090000
DTEND;TZID=America/Los_Angeles:20190723T170000
SUMMARY:Energyplex Day Camp for Jenny Doe
DESCRIPTION: Your child is booked for a camp on this day.
END:VEVENT
BEGIN:VEVENT
UID:20190709T133817-847881910-example.com
DTSTAMP:20190709T133817
DTSTART;TZID=America/Los_Angeles:20190724T090000
DTEND;TZID=America/Los_Angeles:20190724T170000
SUMMARY:Energyplex Day Camp for Jenny Doe
DESCRIPTION: Your child is booked for a camp on this day.
END:VEVENT
BEGIN:VEVENT
UID:20190709T133817-1093239879-example.com
DTSTAMP:20190709T133817
DTSTART;TZID=America/Los_Angeles:20190725T090000
DTEND;TZID=America/Los_Angeles:20190725T170000
SUMMARY:Energyplex Day Camp for Jenny Doe
DESCRIPTION: Your child is booked for a camp on this day.
END:VEVENT
BEGIN:VEVENT
UID:20190709T133817-190860610-example.com
DTSTAMP:20190709T133817
DTSTART;TZID=America/Los_Angeles:20190726T090000
DTEND;TZID=America/Los_Angeles:20190726T170000
SUMMARY:Energyplex Day Camp for Jenny Doe
DESCRIPTION: Your child is booked for a camp on this day.
END:VEVENT
END:VCALENDAR

The expected result is to show the events to be 10 PM - 6 AM in GMT+4 timezone on both Outlook and Google Calendar.


Solution

  • From the info that you provided, your assumption is wrong. Both are showing the correct time:

    Given the start and end date of your events (e.g. start=20190722T090000 for the first one), America/Los_Angeles is in DST at those dates and hence at UTC-7.

    20190722T090000 + 7h = 20190722T160000 in UTC time and when converted to UTC+4, you get 20190722T160000 + 4h = 20190722T200000 so 8PM in your local time.