Magento2: Invalid input datetime format of value, set product as new

Created on 10 Mar 2019  路  20Comments  路  Source: magento/magento2

Preconditions (*)

  1. Magento 2.3
  2. en_US locale

Steps to reproduce (*)

  1. Create or edit product
  2. Change date field for new from to anything
  3. Click Save

Expected result (*)

  1. Product Saves with new from date

Actual result (*)

  1. Error occurs stating "Invalid input datetime format of value '3/09/2019'"
  2. Product does not save.
  3. Clearing the new from or to date allows save

Note: I have searched the issues and everything says that this issue was fixed in 2.3 but I only have the issue in 2.3 where as my 2.2.x installations do not have this problem. Further changing to en_GB accepts the date but i want my locale to be en_us so that date formats are in a format that I am use to.

Any help will be appreciated.

Fixed in 2.3.x Format is valid

Most helpful comment

Hopefully this helps someone else, but I've been able to work around this issue by updating the following line https://github.com/magento/magento2/blob/2.3.1/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php#L332

from " 0:00am" to " 00:00"

which is how it was formatted in older versions of Magento: https://github.com/magento/magento2/blob/2.1.18/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php#L366

All 20 comments

Hi @CKENT0369. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • [ ] Summary of the issue
  • [ ] Information on your environment
  • [ ] Steps to reproduce
  • [ ] Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@CKENT0369 do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [ ] yes
  • [ ] no

Hi @Leandry. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [x] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • _Next steps are available in case you are a member of Community Maintainers._

  • [ ] 6. Add label Issue: Confirmed once verification is complete.

  • [ ] 7. Make sure that automatic system confirms that report has been added to the backlog.

@magento-engcom-team give me 2.3-develop instance

Hi @Leandry. Thank you for your request. I'm working on Magento 2.3-develop instance for you

Hi @Leandry, here is your Magento instance.
Admin access: https://i-21666-2-3-develop.instances.magento-community.engineering/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.

Hi @CKENT0369

The issue was reproduced in 2.3.0 but fixed in 2.3-develop.

So, Please wait for a feature release 2.3.1.

Thank you!

That doesnt do much good for trying to get an an install up and running. What is the lead time on 2.3.1. Also is there a commit that I can look at to find what files need to be change to fix for now.

Bringing this back up. Upgraded to 2.3.1 Issue still remains.

Same issue here, was OK in 2.3.0 but just updated to 2.3.1 and now have this issue. Any fix? Happens if I have a special price on a product. Saves first time but can not edit or save the product again without opening special price and deleting and date data. Very time consuming to make basic edits to any product with a special price or fro date associated with it.

Yes Im having this issue in 2.3.1 also

@Leandry @magento-engcom-team Can you tell me what files have you modified? I don't want to upgrade to 2.3.1 for the time being, thank you.

i am also getting this issue on magento 2.3.1 , is their any fix ?

Is this fixed? I have the issue, I've got all products ready and this is all I need to have my site ready. Anyone have a temporary solution please????

I am facing the same problem with M2.3.1

Hopefully this helps someone else, but I've been able to work around this issue by updating the following line https://github.com/magento/magento2/blob/2.3.1/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php#L332

from " 0:00am" to " 00:00"

which is how it was formatted in older versions of Magento: https://github.com/magento/magento2/blob/2.1.18/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php#L366

Thanks @jcdennen the workaround works magic :) We just switched to 2.3.2 from 2.2.9 last night and client ran into this issue few mins ago

If you've installed magento via composer the path is vendor/magento/framework/Stdlib/DateTime/Timezone.php#L332

If you can't make a programming change, you can also use bulk actions to make the update. That should work. This really appears to be a bug only when you make a change on the simple product edit page.

1) Catalog > Products
2) Check the product you wish to Edit
3) In "Actions" dropdown, click "Update Attributes"

I have the same issue on Magento 2.3.2 fresh install.
Catalog > Products > Product Edit (Simple Product) > Advanced Pricing > Special Price From & To (selected from calendar drop down) > Done > Save = X Invalid input datetime format of value 'Invalid date'

I did what @KholdenSP advised by "Update Attribute" from products list which did not work as it added task "Update Attributes" to the message queue which never processes.

Pretty bad when these simple tasks worked in M2.1.8 but don't work in newer versions.
What's going on Magento, development is meant for making things better, not worse.

I can confirm 2.3.5 that this is broken on customer register/edit screens when "date of birth" is enabled. It will not let me save the customer, saying "Please enter a valid date"

Was this page helpful?
0 / 5 - 0 ratings