cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid input datetime format of value Invalid date magento 2

Invalid input datetime format of value Invalid date magento 2

Steps:

  1. Log in to Admin
  2. Go to Products -> Categories
  3. Input any text in "Category Name" field
  4. Click "Schedule Design Update" -> Input any numbers in " Schedule Update From/To" fields
  5. Click "Save"

Actual result: blank page, error in log

"Invalid input datetime format of value 'Invalid date'";i:1;s:5854:"#0 /var/www/kozhemyakin/store_216ce/vendor/magento/zendframework1/library/Zend/Filter.php(114): Magento\Framework\Stdlib\DateTime\Filter\DateTime->filter('Invalid date')
Expected resullt: "Invalid input date format" message appears

Also it the same when you try to save product 

save_product_datetime issue.png

PROBLEM:

It because there are some attribute like custom_design_from or custom_design_to, news_from_date or news_to_date get value="Invalid date" you can inspect source to view:

 

<input class="admin__control-text _has-datepicker" type="text" data-bind="
    hasFocus: focused,
    datepicker: { storage: shiftedValue, options: options },
    valueUpdate: valueUpdate,
    attr: {
        value: shiftedValue,
        name: inputName,
        placeholder: placeholder,
        'aria-describedby': noticeId,
        disabled: disabled
    }" id="dp1497002098538" value="Invalid date" name="product[custom_design_from]" placeholder="" aria-describedby="notice-BQKPEC7">

SOLUTION:

 

- Go to table eav_attribute find attribute_code with custom_design_from or custom_design_to, news_from_date or news_to_date then you will get attribute id

- Now open table catalog_product_entity_datetime search by attribute_id you will see datetime value wrong, please correct it or delete.

NOTE:

- This way apply for mass product and it often wrong if value = 0000-00-00 00:00:00

- Or you can select other date in datetime select in product detail if issue only for one product.

Finally you need run reindex: bin/magento indexer:reindex

Hope for help.

 

-------
Crystal-Techs Solution: http://crystal-techs.com/
5 REPLIES

Re: Invalid input datetime format of value Invalid date magento 2

hello i am facing same problem in Magento 2.1.7

this is cache issue please use different browser and check again its work

products add in cart successfully   

Re: Invalid input datetime format of value Invalid date magento 2

I have the same problem on all datepicker fields and I tested in all browsers and the issue persists (obviously I refreshed the cache every time).

It is a very critical issue. I use Magento 2.1.8.
Two days I try to figure out how to fix the problem, but the solution is not simple.

 

Re: Invalid input datetime format of value Invalid date magento 2

Hi,

 

I have the same problem, when i want to add new product: Invalid input datetime format of value 'Invalid date'.

FYI : I use french for local interface.

Magento 2.1.9

Waiting for solution.

 

Thanks and regards,

are you available to develop ecommerce site

Our company offers online event registration.  We wish to add a stand-alone module for online shopping.  Wish to use Magento open source.  Our programmers will integrate with credit card gateway but need the rest developed.  We will want the page(s)  to look similar to our site.  My email address is johnb@youractiveworld.com    thank you

Re: Invalid input datetime format of value Invalid date magento 2

I had the same issue and, after following your instructions I found that there was no row in the catalog_product_entity_datetime table. I was in a development environment with a database backup so I truncated this table and it fixed the issue for me. Hope this helps someone else with this issue.