1

Saving or updating an entry gives an error message "The date you submitted is not valid." Its on a fresh install of EE 2.9.3 with Publisher 1.6.2 (where Publisher shouldn't be the problem I guess). I had some extensions installed which most of them are uninstalled now (Event Helper, MX CP Notice, Limitee, single entry)

If I change the entry date "14/4/2015 09:05" to "14-4-2015 09:05" I can save the entry.

I also have not changed any of the config parameters.

I never had this before on EE 2.9.3.

Are there any ideas why this happens?

2

Update: Wes Baker posted, that there are "official solutions".

In ..../system/expressionengine/libraries/Localize.php around line 283 remove the following block of code:

if ( ! empty($date_string) &&
    ! is_numeric($date_string) &&
    @strtotime($date_string) === FALSE)
{
    return FALSE;
} 

And:

Open system/expressionengine/fieldtypes/date/ft.date.php and find this block of code around line 100 and remove it:

if (preg_match(’/\d{1,2}-\d{1,2}-\d{2}\b/’, $data))
{
    return lang(‘invalid_date_ambiguous’);
} 

Now, open up system/expressionengine/libraries/Localize.php and find the _datetime() function around line 289 and add this to the top of the function:

// Checking for ambiguous dates but only when we don't have a date
// format.
if ( ! $date_format)
{
    if (preg_match('/\b\d{1,2}-\d{1,2}-\d{2}\b/', $date_string))
    {
        return FALSE;
    }
} 

//

Original Answer:

Two changes seems to fix it in cp, PHP 5.4:

/system/expressionengine/fieldtypes/date/ft.date.php

In function validate, delete lines 100–103:

if (preg_match(’/\d{1,2}-\d{1,2}-\d{2}\b/’, $data))
{
return lang(‘invalid_date_ambiguous’);
}

/system/expressionengine/libraries/Localize.php

In function _datetime, delete the “Fix for some versions of PHP 5.2 ...”, lines 283–290:

if ( ! empty($date_string) &&
! is_numeric($date_string) &&
@strtotime($date_string) === FALSE)
{
return FALSE;
}
1

Head on over to your EE backend. If you go to Admin -> Localization Settings, you should set your default date format, and make sure to hit save to make it updated. It should be set to

mm/dd/yy 

See if that does the trick.

Edit: In 2.9.3, it even shows the full four year format, so make sure you set it to

mm/dd/yyyy
2
  • Thanks jchrono-battle I had to set the localization Settings in My Account to the same as in Admin Localization Settings, both to mm/dd/yyyy Compared with 2.9.2 where we have a setting for dd-mm-yy we don't have this setting in 2.9.3 anymore. It is replaced with dd/mm/yyyy. And if you choose that you are in trouble. That looks a bug to me. Apr 16 '15 at 12:39
  • Reported to the Bug Tracker Apr 16 '15 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.