Bug #21743 Fix is in Upcoming Release

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

Version: 3.2.1 Reporter: Robin Sowell

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

  • This is still true in 3.5.6.

    I have a Date field that I would like to use for a Publication Date, which should be a specific fixed date not subject to time zone shifting.

    As long as I’m here, I’d like to make a related feature request: it would be great to have a setting on a Date field to set fixed/localized for all instances of the field (like there is on a Date field within a Grid).

    Thanks for your time.

    mvdesign
    20th April, 2017 at 3:15pm
  • Experiencing same in 3.5.11

    Richard Whitmer
    29th September, 2017 at 1:23pm
  • I’ve got a fix in for the next release and posted the solution to this bug. Give it a try and let me know if it resolved the bug for you.

    Seth Barber
    04th October, 2017 at 2:00pm
  • Thanks. No change after inserting the code block in the solution at line 316.

    Richard Whitmer
    05th October, 2017 at 1:08pm
  • Hi Richard,

    Sorry about that! There were some additional changes I forgot to add to the solution. I’ve updated the solution. Would you care to test it again?

    Seth Barber
    06th October, 2017 at 12:24pm

You must be signed in to comment on a bug report.

  • 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;

ExpressionEngine News

#eecms, #events, #releases