ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Daylight Savings Time

August 05, 2011 4:40am

Subscribe [6]
  • #1 / Aug 05, 2011 4:40am

    khoivinh's avatar

    khoivinh

    8 posts

    Hi,

    I’m running EE 2.2.1 on an EngineHosting server, with content that’s been moved along since EE 1.6 (and maybe earlier). I’m trying to get daylight savings time set up properly, and hopefully to automate, as much as possible, the process of switching it on/off.

    I’ve seen a lot of forum posts and conflicting information about Daylight Savings Time. Many mention an “Honor the Daylight Savings Time setting associated with each channel entry” setting on the Localization page and a “DST Active on Date of Entry” checkbox on the Publish page, but I see neither of those settings in the CP.

    Have they been removed? In places, the documentation seems to imply that they have been: an EE 2.1.4 release note says the “Honor…” setting was removed, and the “DST Active…” checkbox is no longer described in the user guide. But the user guide still includes the “Honor…” setting, and a screenshot in the section describing the Publish “Options” tab still shows the DST checkbox, so I’m a bit lost.

    If they haven’t been removed, what can I do to get them to show in the CP?

    If they have been removed, how should I configure the remaining settings? I’d expect each post to always remember, and display according to, whether DST was active when it was posted. Yet, if I turn DST on from the Localization page and then make a post, the post’s time changes (goes back an hour) as soon as I turn DST back off. Also, in the database, the post is always saved with `dst_enabled` = ‘n’, regardless of what the DST setting was at posting time.

    So I’m baffled. What’s going on?

  • #2 / Aug 05, 2011 12:01pm

    airways's avatar

    airways

    154 posts

    The value dst_enabled = n is supposed to indicate that daylight savings was not currently being observed when the entry was created / last updated. Since it probably should be (depending on where your site is located), this probably means that your site’s timezone is set to GMT, which is the default. This has always been a bit of a point of trouble though… so I wouldn’t be totally surprised if your timezone is set correctly, either.

    Note that both of these settings are available in the global Localization settings page as well as under your member account’s individual Localization settings page… double check both to make sure they are set how you expect them to be.

  • #3 / Aug 05, 2011 12:05pm

    Ryan M.

    1511 posts

    I don’t know if any of these will help, but I use some of these config settings:

    $config['time_format']           = 'us';
    $config['server_timezone']       = 'UM5';
    $config['server_offset']         = ''; 
    $config['daylight_savings']      = date('I') ? 'y' : 'n';
    $config['default_site_timezone'] = 'UM5';
    $config['default_site_dst']      = date('I') ? 'y' : 'n';
    $config['honor_entry_dst']       = 'n';
  • #4 / Aug 05, 2011 12:45pm

    khoivinh's avatar

    khoivinh

    8 posts

    @airways No luck… The timezone was already set correctly (to UTC-5) in the global settings and for my member account. DST was turned off on my account page, but when I turn it on the same thing happens as with the global setting: I make a post with it on, the post shows up at the right time; I turn DST off, and the post jumps back an hour. So EE isn’t honoring the entry’s dst setting. (Even though the “Honor…” setting isn’t showing up in my CP, by the way, I unserialized the config values in the exp_sites database table, and one of them is ‘honor_entry_dst’ = ‘y’.)

    Re `dst_enabled` = ‘n’ that’s the value that’s always stored in the database—even when, in both the global and member settings, the proper timezone is set and DST is turned on at the time of posting.

    Btw, the timezone is also set to match in php.ini, and that timezone is reflected as the default server timezone when I do a phpinfo().

    I’ve also checked all the member accounts, and none of them have “Use this member’s localization settings as the master site default?” turned on.


    @mdesign
    I’ll give those a go. Really like the date(‘I’) bit, and hope to use it in the ultimate solution.

  • #5 / Aug 05, 2011 4:08pm

    khoivinh's avatar

    khoivinh

    8 posts

    Ok, I tried @mdesign’s settings in my config.php file (both with honor_entry_dst set to ‘n’ and to ‘y’), but the same basic problem persists: the post is saved to the db with `dst_enabled` = ‘n’ , even though DST is enabled at post time in all the various preference screens, and when I switch the DST off (by manually setting it to that in the config file and user preferences), the post time jumps back.

    In case it helps, here’s a dump of the site system preferences from the exp_sites table (with some private or irrelevant settings removed).

    array (
      ‘encryption_type’ => ‘sha1’,
      ‘site_url’ => ‘http://www.subtraction.com/’,
      ‘weblog_nomenclature’ => ‘weblog’,
      ‘max_caches’ => ‘150’,
      ‘captcha_url’ => ‘http://www.subtraction.com/images/captchas/’,
      ‘enable_db_caching’ => ‘n’,
      ‘enable_sql_caching’ => ‘y’,
      ‘force_query_string’ => ‘n’,
      ‘template_debugging’ => ‘y’,
      ‘include_seconds’ => ‘n’,
      ‘admin_session_type’ => ‘c’,
      ‘allow_username_change’ => ‘y’,
      ‘allow_multi_logins’ => ‘y’,
      ‘password_lockout’ => ‘y’,
      ‘password_lockout_interval’ => ‘1’,
      ‘require_ip_for_login’ => ‘y’,
      ‘require_ip_for_posting’ => ‘y’,
      ‘deft_lang’ => ‘english’,
      ‘xml_lang’ => ‘en’,
      ‘charset’ => ‘utf-8’,
      ‘time_format’ => ‘us’,
      ‘server_timezone’ => ‘UM5’,
      ‘server_offset’ => ‘’,
      ‘daylight_savings’ => ‘n’,
      ‘default_site_timezone’ => ‘’,
      ‘default_site_dst’ => ‘’,
      ‘honor_entry_dst’ => ‘y’,
      ‘cp_theme’ => ‘corporate’,
      ‘publish_tab_behavior’ => ‘hover’,
      ‘sites_tab_behavior’ => ‘hover’,
      ‘enable_throttling’ => ‘n’,
      ‘is_site_on’ => ‘y’,
      ‘show_profiler’ => ‘n’,
    )

    One thing that jumps out at me is that ‘default_site_timezone’ and ‘default_site_dst’ are empty—even though these seem to be set on the Localization page. (For the sake of simplicity, I’ve now turned off “Members can set their own Localization Settings”, and checked all the members manually before, so I don’t think a member’s settings are being used as the default.)

    The settings on the global Localization page (screenshot attached) persist between logins, so where are they stored if not in the db field expanded above?

  • #6 / Aug 05, 2011 6:48pm

    Brandon Jones's avatar

    Brandon Jones

    5500 posts

    Hi khoivinh,

    Both the “Honor the Daylight Savings Time setting associated with each channel entry” setting on the Localization page and “DST Active on Date of Entry” checkbox on the Publish page have been removed. I am not sure that I understand the problem though; since we are currently observing DST, if you (incorrectly) set DST to off, the post’s time jumping backwards would be expected, no?

  • #7 / Aug 05, 2011 7:41pm

    khoivinh's avatar

    khoivinh

    8 posts

    @Brandon No, I’d expect the post to retain the same time it had when it was posted, i.e. if I make a post at 2:30PM when DST is on, I’d like to set EE up so that it continues to say it was posted at 2:30 once DST goes off.

  • #8 / Aug 08, 2011 5:53pm

    Brandon Jones's avatar

    Brandon Jones

    5500 posts

    That makes sense. Let me dig a little further on this; thanks for your patience.

  • #9 / Aug 08, 2011 7:25pm

    khoivinh's avatar

    khoivinh

    8 posts

    Great. Thanks Brandon!

  • #10 / Aug 08, 2011 7:27pm

    Brandon Jones's avatar

    Brandon Jones

    5500 posts

    Okay, I could replicate what you were seeing with the following settings:

    Members > Preferences > Allow members to set their own localization preferences: Yes
    Admin > Localization Settings > Daylight Saving Time: Yes or No (did not matter)
    My Account > Localization Settings > Daylight Saving Time: No ({entry_date} shows 1 hour behind, setting to Yes corrects)

    But with the following settings I could not get {entry_date} to change:

    Members > Preferences > Allow members to set their own localization preferences: No
    Admin > Localization Settings > Daylight Saving Time: Yes or No (did not matter)
    My Account > Localization Settings > Daylight Saving Time: Yes or No (did not matter)

    You seem to be saying that you’re seeing the entry_date change even with the settings directly above? There does seem to be some inconsistent behavior, so I’m not ruling out a bug. Just want to be sure we’re on the same page here. Thanks khoivinh!

  • #11 / Aug 08, 2011 8:48pm

    khoivinh's avatar

    khoivinh

    8 posts

    Hi Brandon,

    You’re right. When I make a post with “Allow members to set their own localization preferences” set to off, {entry_date}‘s output does not change if I modify the DST setting later. I hadn’t tried posting with this setting off before (I’d only looked at how changing the setting affected the db).

    But now a related problem is occurring: {entry_date} isn’t reflecting the state of the DST setting at the time the post was made. That is, if I make a post now with DST on (in Admin > Localization), its {entry_date} shows up an hour behind. So, the {entry_date}s are no longer changing, but they’re simply showing up as though DST were always off.

  • #12 / Aug 10, 2011 5:25pm

    Sue Crocker's avatar

    Sue Crocker

    26054 posts

    OK, here’s what I want to know..

    I add an entry on my granddaughter’s birthday, 4 December at 7AM. DST is off when that happens.

    So when I view it now, should I see 4 December at 7AM, or 6AM? Assuming DST is now on.

  • #13 / Aug 10, 2011 7:35pm

    khoivinh's avatar

    khoivinh

    8 posts

    You should still see 7AM.

  • #14 / Aug 10, 2011 7:44pm

    Focus Lab Dev Team's avatar

    Focus Lab Dev Team

    1129 posts

    Sorry to jump in - I’ve been following the thread and I’m genuinely curious about something.

    OK, here’s what I want to know..

    I add an entry on my granddaughter’s birthday, 4 December at 7AM. DST is off when that happens.

    So when I view it now, should I see 4 December at 7AM, or 6AM? Assuming DST is now on.

    In what instance would you ever want to see 6AM?

    If I were to tell someone about something historical that has time associated with it, like 9/11 for example, I would never stop to think whether or not we were observing DST. It happened at the same time of day no matter when I tell the story during the year.

    Why does EE “respect” DST in such an interesting fashion? Was was the original intent behind that?

  • #15 / Aug 11, 2011 1:09am

    Sue Crocker's avatar

    Sue Crocker

    26054 posts

    Hi, Erik. We’ve asked ourselves the same questions. 😊 I can also replicate the problem with the date/time in the database.

    If I do:

    GMT Entry Date:{gmt_entry_date format="%D, %F %d, %Y - %g:%i:%s"}

    The time of the entry doesn’t shift. So a solution is to format the gmt_entry_date, taking away or adding to items depending on which time zone you’re in, and if DST is on.

    Head pounding stuff 😊

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases