Simple Google Calendar Widget
[simple_gcal widget] Date is displayed in UTC, not according to Timezone (1 post)

  1. craigofnz
    Posted 3 years ago #

    When rendering the day, if the source calendar appointment has a time specified, the date is selected from the PHP default timezone, which in WordPress is always set to UTC - for in their wisdom WordPress prefers to adjust the time offset itself.

    The Simple Google Calendar Widget makes use of the PHP function strtotime, which as far as I can tell would normally handle timezone conversion itself.

    In order to correct this issue for our site, although I am certainly no developer - I made some changes to the constructor to set the PHP timezone, and added a destructor to undo this in simple_gcal.php so as not upset other WordPress functions later.

    I am not sure if this is the cleanest solution, and certainly these changes would be lost if there were any updates received for the plug-in.

    I would appreciate a fix to be incorporated into this plugin in a future release.

    Kind regards,

    This is a hack, not a fix:

    class Simple_Gcal_Widget extends WP_Widget
        public function __construct()
            // load our textdomain
            load_plugin_textdomain('simple_gcal', false, basename( dirname( __FILE__ ) ) . '/languages' );
            // Begin DATE HACK
            // End of DATE HACK
            parent::__construct('Simple_Gcal_Widget', 'Simple Google Calendar Widget', array('description' => __('Displays events from a public Google Calendar', 'simple_gcal')));
        // Begin DATE HACK
        public function __destruct()
        // End of DATE HACK


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Simple Google Calendar Widget
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic