Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Contributor Nick Young

    (@nickyoung87)

    So this is just happening randomly it seems?

    The timezone stuff has been a problem for a while and we refine it and refine it more and more, but it seems like there is always something else that comes up. Not 100% on what the root cause could be for this at the moment.

    Thread Starter Cornelia Villeneuve

    (@codedogs)

    Had it happen again this morning, but a different flavour. Instead of UTC, my widget started displaying using the 12 hour clock instead of 24.

    Reset the feed and all was well again.

    Very odd.

    Plugin Contributor Nick Young

    (@nickyoung87)

    That is definitely strange. I will keep an eye on it myself to see if I can replicate this seemingly random behavior so we can fix it. If you get any more details please feel free to share.

    Thanks!

    Thread Starter Cornelia Villeneuve

    (@codedogs)

    Happened again. Times were in UTC again. Google Calendar looked fine.

    Plugin Contributor Nick Young

    (@nickyoung87)

    Do you have any other plugins that could be affecting the time? Or maybe cache?

    Thread Starter Cornelia Villeneuve

    (@codedogs)

    Found it!

    There are 3 calls to
    $ctz = get_option( ‘timezone_string’ );

    However there are NO calls to: date_default_timezone_set($ctz)

    In a plug-in I wrote last year, I ran into a similar problem because no matter what I did, timestamps always displayed in UTC. The conclusion I came to was that WordPress was NOT setting the time zone, so any call to mktime would result in a UTC time instead of America/Toronto. By adding the following code after each of the above 3 get_option calls, I managed to get it to display the timestamp using the proper time zone.
    `if (!empty( $ctz ))
    {
    date_default_timezone_set($ctz);
    }’

    phpinfo() shows Default timezone is set to UTC hence the reason it is showing times in UTC.

    Plugin Contributor Nick Young

    (@nickyoung87)

    @codedogs,

    Did you modify this in the plugin and it is working for you now?

    Also if you have a GitHub account please feel free to start a Pull Request, I would be happy to review it.

    https://github.com/pderksen/WP-Google-Calendar-Events

    Thanks!

    Thread Starter Cornelia Villeneuve

    (@codedogs)

    Sorry, I do not have a GitHub account, you can do it on my behalf.

    I modified the plug-in as I described and it is working consistently now. The 3 calls to get_option are in class-gce-event.php and class-gce-feed.php

    Pretty sure by modifying the php.ini file you can reproduce the problem, but it appears to take up to 24 hours to reproduce.

    The website I’m using the Google Calendar Events plug-in in is https://www.OrleansArmyCadets.ca. I wrote short code to display the contents of the event on a post by extracting it from the gce_feed transient.

    Thread Starter Cornelia Villeneuve

    (@codedogs)

    Just when I thought I had it completely solved.

    Do not make the change in class-gc-event.php function process_shortcode. By doing so, the time zone changes by -4 hours.

    Plugin Contributor Nick Young

    (@nickyoung87)

    @codedogs,

    Cool, thanks for the update. I will continue to look at this and see if there is anything else that is causing it.

    Plugin Contributor Nick Young

    (@nickyoung87)

    @codedogs did you find anything else that helps with this?

    Plugin Contributor Nick Young

    (@nickyoung87)

    Assuming this got resolved since there has not been any replies here. Let us know if there is anything else we can help with.

    Thanks!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Timezone changes to UTC’ is closed to new replies.