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.
Options

Incorrect Time/Zone Issue

digiwthdigiwth New
edited May 2013 in Vanilla 2.0 - 2.8

In a unique pickle here.

Vanilla was installed when the time on the server was incorrect (off by about 8 hours, have to love shared hosting), when the server time was set correctly, it has skewed time on all existing accounts, guests see the time correctly, but as soon as they're logged in the time is offset by -4 hours.

I am assuming GDN_User.HourOffset is the users GMT offset, which is set correctly for the account I'm testing with, but not seeing any other sort of time zone/offset settings.

Edit: Forgot to mention, yes, PHP has a timezone set, ini_get('date.timezone') returns America/Los_Angeles

Comments

  • Options
    hgtonighthgtonight ∞ · New Moderator

    I know the default timezone is 'America/Montreal'. The actual client hour is updated through JS in js/global.js.

    What version of Vanilla are you running?

    What do you want to accomplish?

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options
    digiwthdigiwth New
    edited May 2013

    This is the latest develop branch (needed the embedding js), there is nothing to suggest the default timezone is Montreal. I have seen other posts suggesting to modify the bootstrap.php, while a little different in the dev branch, is currently set to UTC.

    Two installs on the same machine, both set to UTC, the new install returns the proper time, the one installed while the server time was incorrect remains to be incorrect (off by -4 hours). There is existing data in the "broken" install, so remedying the problem would be much preferable to having to move it over to another install.

  • Options
    hgtonighthgtonight ∞ · New Moderator
    edited May 2013

    Latest develop version? 2.1b1, 2.2, 2.0?

    The default timezone is set in bootstrap.php on 2.0.18.8:

    // Make sure a default time zone is set
    if (ini_get('date.timezone') == '')
       date_default_timezone_set('America/Montreal');
    

    You can update the GDN_User.HoursOffeset manually if you need via SQL or your favorite db editor.

    Or, are the offsets ostensibly correct and it is still off by 4 hours?

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options
    businessdadbusinessdad Stealth contributor MVP

    @digiwth said:
    I am assuming GDN_User.HourOffset is the users GMT offset

    Based on my findings, the Hour Offset is calculated against Vanilla's configured time zone, not against GMT. Also, every timestamp is saved to the database based on the configured time zone.

    For example, if I post a discussion at 8 PM (GMT) on a forum configured with default America/Montreal time zone, its timestamp will be saved as 3 PM (i.e. GMT-5). The time zone is not saved with the value, it's simply taken from the configuration and applied to all timestamps. If you change the time zone later, you can imagine that things become quite messy.

    I had to deal with such issue when I developed my Post Scheduler plugin, and I made it so that all the timestamps are saved as GMT, with the time difference calculated on the fly.

  • Options

    I have the same problem. I changed my default timezone to Eastern in the bootstrap.php, but my offsets are still four hours off for eastern time. How can I fix this? I can't change it back, because that would impact all of our data.

  • Options

    @mjsamberg said:
    I have the same problem. I changed my default timezone to Eastern in the bootstrap.php, but my offsets are still four hours off for eastern time. How can I fix this? I can't change it back, because that would impact all of our data.

    do you mean the in the user table for all users...

    the offset column

    UPDATEGDN_UserSETHourOffset= '0'

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    ShadowdareShadowdare r_j MVP
    edited October 2013

    @mjsamberg, you would have to change the date.timezone setting in PHP.

    Add Pages to Vanilla with the Basic Pages app

Sign In or Register to comment.