Upcoming Calendar Events sidebar applies timezone difference two times
Submitted erosion, Jun 01 2012 04:29 AM | Last updated Jun 01 2012 04:29 AM
I have modified the hooks.php to display the start time of events in the sidebar and it has worked ok for us so far.
After updating both the forum and the calendar to the most recent versions, the sidebar now displays the times wrong.
By modifying the users own timezone setting it becomes apparent that the timezone difference is applied two times to the sidebar list of events.
-all of our users have GMT+2 in their own settings
-sidebar start times are +2 hrs off
-changing the users timezone setting to, for example, GMT+3, results in sidebar times being +3 hrs off.
After updating both the forum and the calendar to the most recent versions, the sidebar now displays the times wrong.
By modifying the users own timezone setting it becomes apparent that the timezone difference is applied two times to the sidebar list of events.
-all of our users have GMT+2 in their own settings
-sidebar start times are +2 hrs off
-changing the users timezone setting to, for example, GMT+3, results in sidebar times being +3 hrs off.
| Status: | Fixed |
| Version: | 3.3.0 |
| Fixed In: | 3.3.1 |











5 Comments
FROM
$c_time = gmstrftime( '%x', $event['_start_time'] );
TO
$c_time = gmstrftime( '%A %d.%m. %H:%M', $event['_start_time'] );
By setting my user accounts timezone to something that makes an event take place near midnight (eg. 23:30) for me, the sidebar will show the event taking place on the following day, hence proving that the 'doubling' of the timezone difference takes place regardless of the strftime string.
What's happening. You enter an event for 23:30 GMT -5
It's stored in the DB as
Which is correct.
It's stored in the cache as
[event_start_date] => 2012-06-01 23:30:00Which is also correct-ish.
BUT.. the hooks.php file has this
if( !$u['event_all_day'] ) { if( $this->memberData['member_id'] AND $this->memberData['time_offset'] ) { $u['_start_time'] = $u['_start_time'] + ( $this->memberData['time_offset'] * 3600 ); } else if( !$this->memberData['member_id'] AND $this->settings['time_offset'] ) { $u['_start_time'] = $u['_start_time'] + ( $this->settings['time_offset'] * 3600 ); }Which, takes the user offset out again.
So.. The problem here looks like the event start time is cached with the event timezone already taken into account.
If you remove the above re-offset.. It works fine.. So long as the user viewing the event is in the same timezone as the event starter.
So.. The long and short of this is that the date is cached WITH the offset applied. Which.. That seems to be the problem, because, without the event timezone that it's cached in noted.. You can't back it out and properly apply the actual user offset.