- Magento Development
- Magento Services
- Industry Solutions
- Hire Magento Developer
Today, I was working on a Magento 2 project.
Everything was going smoothly, until I tried to add a product.
I thought code was installed properly so I was expecting a positive acknowledgement.
But instead, I faced an error which was saying:
DateTime::__construct(): Failed to parse time string (28/11/2019) at position 0 (2): Unexpected char
I had a discussion with my colleagues about it and we came with this solution.
We made an update in this file :
The update we are talking about is nothing, but below one line code.
private function convertSpecialFromDateStringToObject($productData)
if (isset($productData['special_from_date']) && $productData['special_from_date'] != '')
$productData['special_from_date'] = $this->dateFilter->filter($productData['special_from_date']); // Add this line
$productData['special_from_date'] = new \DateTime($productData['special_from_date']);
After applying that update things worked for me. If you ever faced with such situation, I advised you to do the same.
create the event.xml on your module under the Vendor/Module/etc/event.xml and...
If you need a custom meta tag for a specific...
Generally, if you load font as preload, it will load...
Step 1: First you need to add di.xml in the...
Override the vendor/magento/module-sales/view/frontend/templates/email/items/order/default.phtml file on your theme and add the...