Open mclwill opened 7 months ago
@mclwill that is interesting, especially since when we last worked on the Events Calendar it was for a customer in Melbourne, Australia.
Is your calendar URL public? Would be good to check it out. If not, that's OK. I would do a basic check of making sure that WordPress is timezone is set to Melbourne/Australia and not GMT+11.
WP timezone is set to Melbourne/Australia.
I have just made the URL public for you to have a look : https://zoedaniel.com.au/civicrm-events-calendar/
Thanks @mclwill that does look a bit odd. I don't have an immediate answer, we will need to review and see what may be causing that issue. Might take a week or two to get back to this one.
Thanks for taking a look. I will need to make that URL private again.
If you could let me know I will make public again when you are checking.
I've done some trial and error changes - this plugin seems to fix the problem. https://wordpress.org/plugins/use-clients-time-zone/
But would be good to know why it is needed. Thanks again for your help.
I've had to remove that plugin at it causes some other WP event plugins to display the wrong time zone.
So back to square one.
Any help would be appreciated.
I think I have located the problem I am having:
The code in rest/json-all-events.php is not formatting the start and end time of events in line with the FullCalendar requirements. Timezone offsets need to have a colon between hour and minutes (see https://fullcalendar.io/docs/timeZone) in line with ISO8601.
But for some strange reason PHP function date_format needs parameter DATE_ATOM (and not DATE_ISO8601) to achieve the correct format for ISO8601 - see https://www.php.net/manual/en/class.datetimeinterface.php#datetimeinterface.constants.types
Need to change this in four places of get_all_events in rest/json-all-events.php and also do an extra call to wp_timezone() in else statement of get wordpress timezone
when I change the date formatting as per the following I am getting the correct resuls :
'start' => (new DateTimeImmutable($event['start_date'], $tz))->format(DateTime::ATOM),
The full calendar is displaying events with a delay of 11 hours from the time recorded for the event in Civi - clearly it is thinking the times are UTC. However when I download a calendar of events from Civi - ie an ical.ics all of the timezone information for the events is correct (ie. set for GMT + 11 hours for Melbourne Australia). Not sure what has to be done to get full_calendar displaying in the correct timezone