I’m working with Google Calendar API in my Flutter app and facing an issue with timezone handling. When I fetch events using the list method, the returned dates are always in UTC format even though I specify a timezone parameter.
I’ve tested various timezone formats but none seem to work:
US/Pacific
UTC-08:00
GMT-8
America/New_York
The event start and end times keep coming back in UTC regardless of what I pass to the timeZone parameter. My Google Calendar settings show the correct timezone. Has anyone encountered this behavior before?
same issue here last month with flutter calendar integration. google’s timezone param is basically broken for datetime conversion - they only use it for recurring events. I ditched their conversion and used the intl package instead: DateFormat('yyyy-MM-dd HH:mm').format(utcDate.toLocal()). works perfectly once you accept everything comes back as utc anyway.
This timezone headache is exactly why I ditched manual API conversions years ago. Google Calendar API always returns UTC no matter what timezone parameter you pass - that’s just how it works.
Skip writing custom timezone conversion logic that you’ll constantly maintain and debug. Just automate the whole thing. I’ve built similar integrations where I pull events from Google Calendar, auto-convert timezones, and sync with other systems.
Set up timezone conversion once and forget about it. Create workflows that fetch calendar events, process UTC timestamps into whatever format your Flutter app needs, and cache results to avoid repeated API calls.
I’ve watched teams waste weeks debugging timezone edge cases when they could’ve automated everything in a day. Plus you get better error handling and can easily extend it for other calendar systems later.
The timezone parameter in Google Calendar API doesn’t convert the datetime values to your timezone - it only affects how recurring events get expanded. All datetime values come back in UTC format following RFC 3339 spec, no matter what you set. You’ll need to convert timezones on your end after getting the data. In Flutter, use the timezone package: final localTime = TZDateTime.from(utcDateTime, getLocation('America/New_York')) should work. Yeah, the parameter name is misleading - tripped me up at first too.
Indeed, this situation often surprises new users of the Google Calendar API. The primary point of confusion is that while you can specify a timezone, the API consistently returns datetime values in UTC format by design. The timezone parameter primarily adjusts the interpretation of all-day events and the expansion of recurring events, rather than altering the format of the timestamps themselves. To effectively manage this, it’s beneficial to implement a conversion method in your Flutter application that handles the translation of UTC datetime responses to your desired local time zone. Utilizing methods such as DateTime.parse() and converting to local time will facilitate this process. Ultimately, anticipating UTC as your response format is crucial, and conversion must be addressed in your application logic.