verbb / calendar-links

Generate add to calendar links for Google, iCal and other calendar systems
MIT License
16 stars 6 forks source link

Time zone confusion across platforms #14

Open andrewhawkes opened 2 years ago

andrewhawkes commented 2 years ago

Question

My Craft install has its timezone set to Europe/London and I'm using a DateTime field and passing it straight to the plugin like so:

                        {% set calLink = craft.calendarLinks.create({
                          text: entry.title,
                          from: entry.eventStart,
                          to: entry.eventEnd
                       %}

All of the links and ICS files seem to have the correct start and end times if the event takes place in GMT aka UTC.

However, if an event takes place let's say in August which is BST (UTC+1) the results for each platform and the ICS file seem to be sporadic. Google Calendar, for example, works fine yet Outlook puts the event an hour behind and the ICS file is an hour later than the event.

Is there something I need to do additionally?

Here are some examples - this is an event in BST which starts at 10:00 as set on the field in Craft.

The Google link for this looks like: &dates=20221007T090000Z/20221010T103000Z&ctz=Europe/London& You can see the time is 9:00 but Google I think picks up the timezone and corrects this so it works fine.

The Outlook link looks like &startdt=2022-10-07T09:00:00Z&enddt=2022-10-10T10:30:00Z& You can see this one is 9:00 again and when you open the link it adds to the calendar as 9:00 which is wrong. But I can't see how it would know the timezone to add the +1 hour.

The ICS file:

DTSTAMP;TZID=Europe/London:20221007T100000
DTSTART;TZID=Europe/London:20221007T100000
DTEND;TZID=Europe/London:20221010T113000

Yet when this is opened with the native Calendar app on Windows it says 11:00.

Hopefully, the issue is clear and any help would be greatly appreciated.

Additional context

No response

engram-design commented 2 years ago

So I imagine eventStart and eventEnd are date/time fields in Craft?

But yes, sounds like your finding is correct, that Outlook links don't seem to like the supplied timezone. Which is backed up by this code for Google, which doesn't exist for the Outlook links.

I'll have to do some digging on this.

andrewhawkes commented 2 years ago

@engram-design that is correct, they're both date/time fields.

Thank you.