Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
denchev opened this issue Aug 10, 2017 · 54 comments
Closed

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

denchev opened this issue Aug 10, 2017 · 54 comments
Labels
bug report Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release

Comments

@denchev
Copy link
Contributor

denchev commented Aug 10, 2017

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.

@denchev
Copy link
Contributor Author

denchev commented Aug 10, 2017

Further investigation shows that the issue is caused by 3 specific dates:

  • Special price date range
  • Schedule design update
  • Set product as new from

These three date forms got populated after the update. They were not under 2.1.7.

When these fields are emptied the product save is successful.

@denchev
Copy link
Contributor Author

denchev commented Aug 10, 2017

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

@s00071609
Copy link

Cannot save product, this issue started after updating to magento 2.1.8. Huge bug as it does not allow product modification. Not sure what else it does but so far have noticed product has issue.

@s00071609
Copy link

@denchev Changed to locale from magento admin from english australia to english US, still could not save the product. Pretty sad that each release come with such massive issues.
Would be great if someone could provide a solution. I am sure many would not have tried to save the product in magento 2.1.8. Not sure how to now save the product. Update attribute can be saved

@denchev
Copy link
Contributor Author

denchev commented Aug 14, 2017

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

@s00071609
Copy link

@denchev I changed from store>configuration. Where is the account locale?

@s00071609
Copy link

s00071609 commented Aug 14, 2017

@denchev I found it - account locale. And it works. I hope it does not cause any other issue. Great solution. Thank you

@denchev
Copy link
Contributor Author

denchev commented Aug 14, 2017

@s00071609 Glad it worked out for you as well. Two people experiencing this issue is an indication that it is a problem that needs to be looked after.

@PHOENIX-MEDIA
Copy link

We are experiencing similar problems with price rules in Magento 2.1.8. After switching the locale to de_DE (with and without german language pack) the validation of a selected from or to date fails. The only difference to 2.1.7 we noticed is the date format the Datepicker returns for validation. en_US works fine as workaround but is no real option for us.

@AlexWorking
Copy link

Hello, @denchev. According to Your issue an internal ticket has been created - MAGETWO-71936. You'll be informed as the bug is fixed. Thanks for reporting.

@Olek89
Copy link

Olek89 commented Sep 12, 2017

i have also the same issue, when comes a new update of magento?

@magento-engcom-team magento-engcom-team added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed labels Sep 15, 2017
@magento-engcom-team
Copy link
Contributor

@denchev thank you for your bug report.
We've created internal ticket MAGETWO-75375 to track progress on the issue.

@magento-engcom-team magento-engcom-team added the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Sep 19, 2017
@woakley
Copy link

woakley commented Sep 22, 2017

Same problem here.

@eTonki
Copy link

eTonki commented Oct 2, 2017

The same problem in it-IT

@Yosuatel
Copy link

Yosuatel commented Oct 2, 2017

Updated to magento 2.2.0 and continues the problem when saving the product Invalid input datetime format of value, also in the rule this message Something went wrong when saving the data of the rule. Please review the error log.
This problem is when my profile is in language es_ES

@sopedro
Copy link

sopedro commented Feb 27, 2018

Not fixed in 2.2.3. :(

@ishakhsuvarov
Copy link
Contributor

Fix for the issue is currently targeting release 2.2.4

@okorshenko okorshenko added the Event: distributed-cd Distributed Contribution Day label Mar 2, 2018
@SamB-GB
Copy link

SamB-GB commented Mar 30, 2018

So nothing to go in sale until you release 2.2.4. Is there a file file for this that can be implemented now?

@SamB-GB
Copy link

SamB-GB commented Mar 30, 2018

@sopedro this patch seems to have worked for me https://packagist.org/packages/lcbrq/magento2-dateformatpatch

@joinso
Copy link

joinso commented May 4, 2018

Hi!

I tested @mmularski module on Magento 2.2.4, php 7.1.15, with locale en_GB and it doesn't work.

Any idea?

Regards,
JOINSO

@bedroomathletics
Copy link

I'm getting the same issue on 2.2.4 - I have tried switching from 'en_gb' to 'en_us' without success :(

capture

@katiakweb
Copy link

I'm getting the same issue on magento 2.2.4 when I switch to Portuguese language in Admin account...

@measureddesigns
Copy link

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)"} []

@SamB-GB
Copy link

SamB-GB commented Jul 13, 2018

Has this been corrected in 2.2.5?

@magento-engcom-team
Copy link
Contributor

Hi

This issue seems to be fixed in 2.2.5. Please use the following commit as a reference: 010a646

More commits may be found with this search: https://github.com/magento/magento2/search?q=MAGETWO-71936&unscoped_q=MAGETWO-71936&type=Commits

Thank you

@magento-engcom-team magento-engcom-team added Fixed in 2.2.x The issue has been fixed in 2.2 release line and removed Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Sep 7, 2018
@Quent6457
Copy link

https://github.com/fernandofauth/magento2_datetime fix works for me i'm in 2.2.4 fr_FR thank's

@missvickih
Copy link

Issue still present in 2.2.6 running en_gb locale. php 7.1.18.

Issue presents itself when creating product with special price to and from date (Exception(code: 0): Invalid input date format '23/10/+00201818'). Promotion rules the same issue.

We implemented a fix to store date format for special price (product level) using the below recommended by another dev:
/vendor/magento/module-catalog/Controller/Adminhtml/Product/Initialization/Helper.php
has been added a new function on line 463

private function convertSpecialFromDateStringToObject($productData)
{
if (isset($productData['special_from_date']) && $productData['special_from_date'] != '') {
$productData['special_from_date'] = new \DateTime($productData['special_from_date']);
}

    return $productData;
}

comment the call to that function on line 162
//$productData = $this->convertSpecialFromDateStringToObject($productData);

This has fixed the issue for the product level but promo dates are still affected; they save after the above fix but the dates are being overridden with go today date so renders the promotional rule useless.

I can see multiple threads, all which appear related to incorrect date format when using a non US locale and some suggest just switching the store locale to en_US to fix which seems impractical when our users are GB based. Has anyone in GB switched to local en_US with no store impact as we need to find a quick fix so we can prep our black friday deals?

Anyone else on 2.2.6 with the same issue and a fix which is sitewide rather than just product level which we can use until this is patched / addressed thoroughly?

@jjburbridge
Copy link

Issue still present in 2.2.6 running en_gb locale for "Special From Date", but is correct for "Special To Date"

Please reopen this issue

@garmentprinterink
Copy link

I am having this same issue on Magento 2.3. Has anyone found a solution for this?

@EmilyPepperman
Copy link
Contributor

I am having this same issue on Magento 2.3.1 !

@shreddieb
Copy link

@EmilyPepperman did you by chance find a solution? I've upgraded to 2.3.1 and am also experiencing the date format issue

@rrrspirit
Copy link

I am also having this issue after upgrading to 2.3.1 . I can not save modifications on special prices, as I get "Invalid input datetime format of value '5/08/2019'" error.

@superclean1212
Copy link

superclean1212 commented Sep 10, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release
Projects
None yet
Development

No branches or pull requests