{"id":295,"date":"2020-03-31T12:47:15","date_gmt":"2020-03-31T15:47:15","guid":{"rendered":"http:\/\/hackerzone.com.br\/blog\/?p=295"},"modified":"2020-03-31T13:08:31","modified_gmt":"2020-03-31T16:08:31","slug":"resolvendo-problema-com-datas-no-magento-2","status":"publish","type":"post","link":"http:\/\/hackerzone.com.br\/blog\/resolvendo-problema-com-datas-no-magento-2\/","title":{"rendered":"Resolvendo problema com datas no Magento 2"},"content":{"rendered":"<p>Se voc\u00ea localizou este post \u00e9 porque esta tendo problemas com as datas no Magento 2.2.6<br \/>\nPrincipalmente na configura\u00e7\u00e3o de pre\u00e7o especial no intervalo de datas dentro do <strong>cadastro de produtos<\/strong><br \/>\nPara resolver este problema segui <a href=\"https:\/\/github.com\/magento\/magento2\/pull\/18578\/commits\/88592facd5d34872ac2f2051dda246703091cacc\">estas orienta\u00e7\u00f5es<\/a><\/p>\n<p>Erro:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nDateTime::__construct(): Failed to parse time string (31\/03\/2020) at position 0 (3): Unexpected character\r\n<\/pre>\n<p>Solu\u00e7\u00e3o:<br \/>\nPor\u00e9m o arquivo correto esta em:<br \/>\n\/vendor\/magento\/module-catalog\/Controller\/Adminhtml\/Product\/Initialization\/Helper.php<\/p>\n<p>Na linha 466 adicione o seguinte trecho:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$productData['special_from_date'] = $this-&gt;dateFilter-&gt;filter($productData['special_from_date']);\r\n<\/pre>\n<p>Ficando assim:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\nif (isset($productData['special_from_date']) &amp;&amp; $productData['special_from_date'] != '') {\r\n   $productData['special_from_date'] = $this-&gt;dateFilter-&gt;filter($productData['special_from_date']);\r\n   $productData['special_from_date'] = new \\DateTime($productData['special_from_date']);\r\n }\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Se voc\u00ea localizou este post \u00e9 porque esta tendo problemas com as datas no Magento 2.2.6 Principalmente na configura\u00e7\u00e3o de pre\u00e7o especial no intervalo de datas dentro do cadastro de produtos Para resolver este problema segui estas orienta\u00e7\u00f5es Erro: Solu\u00e7\u00e3o: Por\u00e9m o arquivo correto esta em: \/vendor\/magento\/module-catalog\/Controller\/Adminhtml\/Product\/Initialization\/Helper.php Na linha 466 adicione o seguinte trecho: Ficando [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[136,12],"tags":[137,138],"class_list":["post-295","post","type-post","status-publish","format-standard","hentry","category-magento-2","category-php","tag-erro-data","tag-magento-2","cat-136-id","cat-12-id"],"_links":{"self":[{"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/posts\/295","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/comments?post=295"}],"version-history":[{"count":5,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/posts\/295\/revisions"}],"predecessor-version":[{"id":300,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/posts\/295\/revisions\/300"}],"wp:attachment":[{"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/media?parent=295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/categories?post=295"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/tags?post=295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}