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.

Entry & Expired Dates decreases by an hour when posted/edited

September 30, 2010 10:20am

Subscribe [10]
  • #1 / Sep 30, 2010 10:20am

    jstewart

    11 posts

    Build: 20100810

    Whenever I post or edit a channel entry that has a entry/expiration date after 31st October when DST ends (UK), the time within the date is automatically decreased by 1 hour.

    E.g. I post a date of 2010-11-06 12:00 it will save as 2010-11-06 11:00

    I have the following settings;

    TimeZone: UTC
    Daylight Saving Time: No
    Honor the Daylight Saving Time setting associated with each channel entry? No
    User localisation settings > Daylight Saving Time: No

    I’m using expression engine to run an events calendar, so the time of the event is really important.

    Is there anything I can do to make posts ignore the DST settings and just keep the time that is entered into the post?

    Thanks for the help in advance.

    John

  • #2 / Sep 30, 2010 10:53am

    rjsteck

    18 posts

    I am having the same issue. I was going crazy and thought it was my system.

    I have updated the system/expresionengine/fieldtypes/ft.date.php file so the save function looks like this

    function save($data)
        {
            if ($data != 0 && date("I",$data) == 0){
                $data = mktime(date("H",$data)+1,date("i",$data),date("s",$data),date("n",$data),date("j",$data),date("Y",$data));
            }
            return $data;
        }

    It appears to be working.

    I need to test what happens after the system date is when daylight savings is off, but this will hold you over for a month or so.

    edit… code was bad :(

  • #3 / Sep 30, 2010 11:58pm

    Brandon Jones

    5500 posts

    Hi jstewart,

    In Admin > Localization Preferences, what is set for Honor the Daylight Saving Time setting associated with each channel entry? Have you tried toggling this to see if it helps?

  • #4 / Oct 01, 2010 6:02am

    jstewart

    11 posts

    Hi Brandon,

    ‘Honor the Daylight Saving Time setting associated with each channel entry?’ Is set to ‘No’ toggling it to ‘Yes’ doesn’t change anything. Dates posted after DST ends on the 31st of October decrease by one hour each time they are added or edited.

    John

  • #5 / Oct 01, 2010 1:48pm

    rjsteck

    18 posts

    I have tried every combo possible. I am guessing that since Daylight saving toggles have no effect then that is the problem. I believe the error lies in

    $this->EE->localize->some_date_function_that_is_doing_dst_changes_wrong();

    If you would like to tell me what file this code resides in I would be more than willing to try a “fix” - and not a hack like my code above.

  • #6 / Oct 02, 2010 9:53am

    Jan_Huygens

    106 posts

    hah - I’m having this problem too.  Glad its not just me!

  • #7 / Oct 02, 2010 6:01pm

    rjsteck

    18 posts

    Ok, well I think I found the issue and I would like feedback. Below are lines 470 through 487 of system\expressionengine\libraries\Localize.php It appears that this code is what is messing things up and it appears that this is “intentional” as the comments say exactly what happens yet we don’t want it to happen.

    // Offset the time by one hour if the user is submitting a date
            // in the future or past so that it is no longer in the same
            // Daylight saving time.    
    
            if (date("I", $this->now))
            { 
                if ( ! date("I", $time))
                {
                    $time -= 3600;            
                }
            }
            else
            {
                if (date("I", $time))
                {
                    $time += 3600;            
                }
            }

    I changed the file to look like this and all it well (be sure to take my above hack out of your code)

    // Offset the time by one hour if the user is submitting a date
            // in the future or past so that it is no longer in the same
            // Daylight saving time.    
    
            /*
            if (date("I", $this->now))
            { 
                if ( ! date("I", $time))
                {
                    $time -= 3600;            
                }
            }
            else
            {
                if (date("I", $time))
                {
                    $time += 3600;            
                }
            }
            */
  • #8 / Oct 04, 2010 2:44am

    John Henry Donovan

    12339 posts

    Looks like you are all running into the date bug which was reported and confirmed here

    There are some case scenarios from users within the comments of that report. It looks like your particular case above matches a few. Can you confirm this?

  • #9 / Oct 04, 2010 12:52pm

    rjsteck

    18 posts

    Looks like you are all running into the date bug which was reported and confirmed here

    There are some case scenarios from users within the comments of that report. It looks like your particular case above matches a few. Can you confirm this?

    That does not appear to be the same bug.

  • #10 / Oct 04, 2010 5:01pm

    Ingmar

    29245 posts

    Thank you for your feedback, rjsteck. The issues surrounding time/date and DST are being revisited for the bugfix John pointed to.

  • #11 / Oct 11, 2010 5:30pm

    rjsteck

    18 posts

    Thank you for your feedback, rjsteck. The issues surrounding time/date and DST are being revisited for the bugfix John pointed to.

    Thank you, I will work through that thread to get the issue resolved.

  • #12 / Oct 12, 2010 11:27am

    Sue Crocker

    26054 posts

    Just to add to this thread.. we’re going to be thoroughly testing date/time issues before the next build/version is released. We appreciate your patience.

  • #13 / Oct 20, 2010 4:10pm

    eguystephens

    90 posts

    Has this been fixed yet?

  • #14 / Oct 20, 2010 4:27pm

    Ingmar

    29245 posts

    No, as this is a somewhat complex issue. You can read more about it here.

  • #15 / Nov 02, 2010 3:38pm

    Joe Michaud

    154 posts

    Is there a work-around to the “one hour rollback” problem for new sites?  I have a site launch hanging on this issue.

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

ExpressionEngine News!

#eecms, #events, #releases