Page 1 of 1

k5n webcalendar timezone: Wrong GMT offset

Posted: Sun Dec 26, 2010 7:01 pm
by ^rooker
[PROBLEM]
After upgrading from k5n's php webcalendar v1.2.0 to v1.2.3, the time values are incorrect. They're off by a static offset.

When checking my user's webcalender config under "settings > preferences", it always writes:
Your current GMT offset is -5 hours.
Regardless of what timezone I select.

[SOLUTION]
This seems to be related to a bug in v1.2.3. Thanks to an entry in the sourceforge forums, I was pointed into the direction of the error:

Workaround:
In 'webcalendar/includes/functions.php' on line 3815, there's the following code:

Code: Select all

date_default_timezone_set ( $GLOBALS['TIMEZONE'] );
Disabling it is a workaround (but I'd say no fix).

Fix?
A few lines above, there's the culprit:

Code: Select all

// Set SERVER TIMEZONE.
if ( empty ( $GLOBALS['TIMEZONE'] ) )
$GLOBALS['TIMEZONE'] = $GLOBALS['SERVER_TIMEZONE'];
$GLOBALS['TIMEZONE'] is not empty by default, but has the value:
America/New_York
...the question is: Where does that one come from?