Bug #21743 Bug Fixed

Date field does not allow setting of fixed vs localized in the CP or the channel form.

Version: 3.2.1 Reporter: Robin Sowell

This is an archived bug report. If you are experiencing a similar issue, upgrade to the latest release and if that does not solve the problem, submit a new bug report

It’s not possible to set the date to be a ‘fixed’ date.  No matter what you set, it’s going into the database as NULL.  It also ignores the database setting in the display of the fixed/localized radio on the publish page.

Note- it does work in Grid (though the selecting isn’t shown in grid, the grid settings for fixed/localized are set.)

  • In system/ee/EllisLab/ExpressionEngine/Model/Content/ContentModel.php at line 316 add:

    if (strpos($name, 'field_dt_') !== FALSE)
    {
        $name = str_replace('field_dt_', 'field_id_', $name);
    
        if ($this->hasCustomField($name))
        {
         $this->getCustomField($name)->setTimezone($value);
        }
    
        continue;
    }

    In system/ee/EllisLab/Addons/date/ft.date.php at line 135 replace:

    $date_local = 'field_offset_'.$this->field_id;

    with:

    $date_local = str_replace('field_id_'.$this->field_id, 'field_dt_'.$this->field_id, $date_field);

    In system/ee/EllisLab/Addons/date/views/publish.php at line 4 replace:

    <?= form_radio($localize_option_name, 'y', ($localized == 'y'), $extra) ?>

    with:

    <?= form_radio($localize_option_name, '', ($localized == 'y'), $extra) ?>

    and at line 8 replace:

    <?= form_radio($localize_option_name, 'n', ($localized == 'n'), $extra) ?>

    with:

    <?= form_radio($localize_option_name, ee()->session->userdata('timezone', ee()->config->item('default_site_timezone')), ($localized == 'n'), $extra) ?>

    In system/ee/EllisLab/ExpressionEngine/Model/Content/FieldFacade.php at line 71 replace:

    $this->timezone = $timezone;

    with:

    $this->timezone = $tz;
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases