Timezones – Doubling Offset
-
Was running in to an issue with trying to display a public calendar based in one timezone in the local (explicitly defined) timezone.
Use case:
Displaying EPL soccer team fixtures that were based in Europe/London time: bm14nbipk3hg813ili2emr21oo@group.calendar.google.com
in the local time (America/Denver) for our supporters’ group.When selecting “Events Source Default” it was correctly displaying in London time. When selecting “Site Default” (or Custom) to “America/Denver” it was doubling the offset. So, instead of subtracting 7 hours, it was subtracting 14.
After troubleshoting a bit, I noticed that this line in /includes/feeds/google.php was setting the start timezone back to “Europe/London” even though the time was already converted to “America/Denver” via the API call:
$start_timezone = ! $event->getStart()->timeZone ? $calendar['timezone'] : $event->getStart()->timeZone;
This ended up doing an additional offset which doubled the change. To fix, I changed the line to get the class timezone (rather than the calendar’s) like so:
$start_timezone = ! $event->getStart()->timeZone ? $this->timezone : $event->getStart()->timeZone;
(also made a similar change in the$end_timezoneassignment)This completely fixed my problem with displaying the source in the desired timezone … regardless of the events source settings.
Note that I have not tested with start and end times with specific timezones … so, ymmv.
The topic ‘Timezones – Doubling Offset’ is closed to new replies.