Wrong/different timezone when opening an event imported from Google calendar

I’m using nextcloud 21.0.2 with the Calendar app version 2.2.2. I previously used the Google calendar and did an export of my calendar there. Then I imported this calendar into nextcloud.

My problem does not occur when creating new events and not in events which are on the full day. Only imported events with times (start/end).

When I see the overview (no matter whether it’s month, week, etc.), all times are correct. For example an event which starts at 9am.

But when I open the details of this event, I see 7am as the time. This should also be 9am. When I click the little globe icon, I see that the timezone is UTC. New events have Europe/Berlin.

My timezone is Europe/Berlin, UTC+1 (+2 at the moment).

I have thousands of events, so I cannot change every single event. Also there seems to be no possibility do do a search and replace in the database, because of the way events are stored.

So what can I do? Why is there even the possibility to set the timezone per event?

Please post an excerpt from your Google calendar export which contain such an event. All events in your Google calendar file, which you’ve imported into the Nextcloud database, should contain valid time zone information.

I’ve just found the following thread which seems to describes your problem.

Thanks for your reply.

I already found that thread, it’s the first you find via Google when you search for this problem. :wink:
But it didn’t contain any solution for me.

Here is one sample from the Google calendar export:

BEGIN:VEVENT
DTSTART:20210519T090000Z
DTEND:20210519T103000Z
DTSTAMP:20210526T094343Z
UID:xxxxxxxxxxxxxxxxxxxxxxx@google.com
CREATED:20210517T093103Z
DESCRIPTION:
LAST-MODIFIED:20210517T093103Z
LOCATION:
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:xxxxxxxxxxxxxxxxxxxxxxx
TRANSP:OPAQUE
END:VEVENT

EDIT:
This is the surrounding of all the events:

BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:xxxxxxxxxxxxxxxxxxxxxxx
X-WR-TIMEZONE:Europe/Berlin
**** HERE ARE THE EVENTS ****
END:VCALENDAR

The solution is to disable a specific privacy option in your browser, e.g. Firefox, so that it is allowed to request location information.

For me it looks like the provided event doesn’t contain a valid VTIMEZONE record, but a non-standard X-WR-TIMEZONE entry… which most likely causes your problem. Please find further information here:

This tool might help you to fix the syntax (untested):

The problem occurs on at least three different PCs and I tested it with Firefox, Chrome and Edge. So I guess this is not the solution in my case, because I’m sure this would mean that everyone has this problem.

And why are the times correct in the overview, but not in the detail view?

I analyzed the Google export files again and found out that 3 of 7 calendars have this at the top (below of what I already posted):

BEGIN:VTIMEZONE
TZID:Etc/UTC
X-LIC-LOCATION:Etc/UTC
BEGIN:STANDARD
TZOFFSETFROM:+0000
TZOFFSETTO:+0000
TZNAME:GMT
DTSTART:19700101T000000
END:STANDARD
END:VTIMEZONE
BEGIN:VTIMEZONE
TZID:Europe/Berlin
X-LIC-LOCATION:Europe/Berlin
BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
END:VTIMEZONE

But all imported calendars have the problem, no matter whether they have this information or not. And all timezones are correctly set in the Google calendar settings.

Did anyone here imported Google calendars and had no problem with times? I mean, there are absolutely no settings when exporting from Google or importing into nextcloud.

EDIT: By the way, it seems like the times are correct when I subscribe to the nextcloud calendars in external software/apps. So it’s only in the browser.

I had the exact same problem. After investigating it for quite some time, tinkering with the ics file manually etc. I found out that Nextcloud just correctly imports what’s in the ics file exported from Google. So the issue here is Google exporting calendar events partly with datetimes in UTC (for me almost all of them) and partly in the local timezone.

The only way to fix it and to get to the desired outcome (having all calendar events in local time and with local timezone) is writing a script which converts datetimes to local time and also sets the correct timezone for all of the datetimes in the ics file. Very similar to the Python example linked in a post above.

I put my (very quick and dirty) script written in Ruby in this Gist.

1 Like

Thanks for your reply. I still had no time to investigate the problem further, but I have it on my to-do list. :wink: A script for rewriting the ics files from Google comes too late for me, unfortunately. I use the NC calendar for too long now and have too much new entries. So I think I have to edit the events in the database of Nextcloud.