Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Timezone / HourOffset problem

BleistivtBleistivt Moderator
edited June 2014 in Vanilla 2.0 - 2.8

My vanilla forum (running 2.1) is based in germany, so all times should be GMT+1 (EST) or GMT+2 (CEST) when it's daylight saving time.

I noticed, that GMT+0 times where shown for logged out users, so I changed the default timezone in bootstrap.php


(I would like to keep it that way, as this also fixed numerous problems with plugins showing the wrong time and the smarty time functions.)

Now, for logged out users, times are correct, but for users that are logged in, 2 hours are being added to the time, so GMT+4 times are shown.

Setting the the HourOffset in the Database to 0 for everyone will not work, as it is set back to 2 by global.js:

   var d = new Date()
   var hourOffset = -Math.round(d.getTimezoneOffset() / 60);

   // Set the ClientHour if there is an input looking for it.
   $('input:hidden[name$=HourOffset]').livequery(function() {


Date().getTimezoneOffset() calculates the offset in minutes to UTC/GMT time.

I could just comment this out, but I think this is a bug in Vanilla as the Hour Offset calculation should use the server time and not UTC/GMT.

Is there any way I could change this, so the HourOffset calculation uses the server time?


Sign In or Register to comment.