This past week I worked with one of my clients to configure the Event Organiser plugin and the Event Organiser ICAL Sync extension to synchronize with their iCloud calendar feed, allowing them to update their website’s calendar and events from an iCloud public calendar. I’ll explain the full details of how to do that in a future post, but suffice it to say that there were some challenges along the way.
One of those challenges was getting the timezone right, believe it or not. You would think this would be fairly simple, but the iCloud calendar is not an easy-to-use tool, especially compared to Google Calendar, in my opinion. Here are two examples:
- If you have chosen a default timezone in your iCloud account settings, then you could have an event on your calendar that is the “wrong” time in the ICAL feed, but shows as the “right” time on your iCloud calendar, because iCloud adjusts the event times to match your timezone. For example, my client is in the Mountain Timezone. They had an event starting at 2:30 pm in the Pacific Timezone but it showed on their iCloud calendar as 3:30 pm since they have their default timezone set as Mountain. That works until we tried to sync the calendar feed, because the feed shows that event as 2:30 in the Pacific Timezone.
- If you are in the Mountain Timezone (Denver) but your event timezone in iCloud is listed as Mountain Timezone (Phoenix) then your event is going to be “right” on the website for half the year, and “wrong” for the other half, due to Daylight Savings Time. Arizona doesn’t use Daylight Savings Time, and I agree with them that DST should be abolished, but until that happens this can cause some problems with calendar syncing.
My client had one event listed in the Los Angeles (Pacific) Timezone, and seven events in the Phoenix (Mountain) Timezone. While trying to make this process easier for them I found a filter hook in Event Organiser that would let me override the timezone(s) in an ICAL feed. This “solved” the problem for the events in the Phoenix Timezone, but “caused” a problem for the event in the Los Angeles Timezone, since that start time was actually an hour earlier, even though it appeared in the iCloud calendar as correct, as I explained above in example #1.
In version 2.4 of Event Organiser the filter hook is at line 552 of includes/class-eo-ical-parser.php, and the code in the Gist below is what I used to filter the timezone to use the WordPress timezone set in Settings > General.
Gist – Filter the Event Organiser plugin to use your WordPress General Settings timezone
Where to put this code
Add the code to a core functionality plugin, its own plugin, or functions.php.