magento2: Error: Invalid input datetime format of value '25/07/+00201717'

Preconditions

  1. Magento version: 2.1.8
  2. PHP version: 7.0.20
  3. MySQL version: 5.6.36
  4. Magento is setup as multi website with 2 websites, 2 stores, and 2 store views.

Steps to reproduce

  1. Login to Magento admin
  2. Open an existing product for edit
  3. Click save

Expected result

  1. Product is saved successfully as no changes are made from the previous state of the product

Actual result

  1. An error Invalid input datetime format of value '25/07/+00201717' appears and the product is not saved

This issue happened when I upgrade from 2.1.7 to 2.1.8. Some products seems to be able to save without an issue but majority of the ones I tried has this error with various values for the actual date.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 10
  • Comments: 54 (22 by maintainers)

Most upvoted comments

So I was able to figure out why this happens.

The moment.js library returns invalid date format if the account locale is set to “en_GB”. If this is the case then moment.js returns "“DD/MM/YYYYYYYY” as format for the date.

A workaround for this issue is to change your account locale to something else like English / United States.

Maybe @magento-team should consider updating the library to 2.18.1

Hello I found a solution online and This is how you fix it

/hosting root/your sitre/vendor/magento/framework/Stdlib/DateTime/Timezone.php older version magento/magento2/blob/2.3.2/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php#L332-L332 in some cases Invalid input datetime format of value ‘3/01/2019’ find this code 332. $date .= " 0:00am"; and replace it with the following one: $date .= ’ 00:00’;

l hope that helps

In my case problem was yet another one. On Centos with outdated lib-icu 50.1.2 PHP component IntlDateFormatter was giving ‘dd.MM.yyyy’ pattern instead ‘dd.MM.y’ which I receive with

$format = (new \IntlDateFormatter(
        'pl_PL', \IntlDateFormatter::SHORT, \IntlDateFormatter::NONE
        ))->getPattern();

echo $format;`

on my local Ubuntu PHP instance supported by ICU 55.1. Seems that relying on IntlDateFormatter pattern output is a pretty serious architectural issue.

Sample fix for pl_PL language https://github.com/lcbrq/magento2-LCB-DateFormatPatch Feel free to fork and PR extending with other languages because I don’t that @magento-engcom-team patch would really close all issues like #10756

Also still seeing this issue in 2.2.4 when creating promotion cart rules using GB user and site settings.

[2018-06-27 14:18:35] main.CRITICAL: Invalid input date format ‘27/06/+00201818’ {“exception”:“[object] (Exception(code: 0): Invalid input date format ‘27/06/+00201818’ at /###/vendor/magento/framework/Stdlib/DateTime/Filter/Date.php:69)”} []

Fix for the issue is currently targeting release 2.2.4

@luizpaulofranz , if you have another issue create new report, thank.

Hi @mmularski and @fernandofauth ,

I’ve tried and the problem remains when I try to edit/create a product. I’m on Magento 2.1.10 with pt_BR as interface locale.

@ysapiga I was testing it on en_GB and en_US on Magento 2.1.8 and it works. Could you write error msg from the exception?

edit: I checked adding new product too. Everything works fine for me

@okorshenko can you assign to me?

Maybe this issue is Related with issue #10580 cc @orlangur

@s00071609 I am sorry to hear that you also have this issue. Did you change your account’s locale or did you change the store’s locale? Account locale is the one that did the trick for me.