Bug #23617 Bug Fixed

exp_channel_titles table year and month columns are not storing correct data when create / edit entry date field

Version: 4.1.1 Reporter: Lemonade Team

Below are the settings I have in Settings -> General Settings -> Date & Time Settings Timezone: Australia - Melbourne Date & time format: dd/mm/yyyy 12-hour with AM/PM

When I create entry when date is e.g. 25/5/2018, in database table ‘exp_channel_titles’, ‘year’ ‘month’ and ‘date’ columns are blank. However ‘entry_date’ column has correct timestamp date. But when I edit it and set 10/5/2018, ‘year’ has 2018, ‘month’ has 10 and ‘date’ has ‘5’. So I think it’s considering mm/dd/yyyy when it stores details in those 3 columns.

Is there any existing fix for this? I need this resoled as I am using “low yearly archive” plugin and it’s using those 3 fields to show archive. Also I do think this is a bug in ExpressionEngine as it should be considering date format set in Settings for all dates.

  • system/ee/EllisLab/ExpressionEngine/Model/Channel/ChannelEntry.php line 172 change the method to look like:

    public function set__entry_date($entry_date)
        {
         $entry_timestamp = $this->stringToTimestamp($entry_date);
         $this->setRawProperty('entry_date', $entry_timestamp);
    
            // Day, Month, and Year Fields
            // @TODO un-break these windows: inject this dependency
         $this->setProperty('year', ee()->localize->format_date('%Y', $entry_timestamp));
         $this->setProperty('month', ee()->localize->format_date('%m', $entry_timestamp));
         $this->setProperty('day', ee()->localize->format_date('%d', $entry_timestamp));
        }
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases