Closed PierAlex closed 7 years ago
@PierAlex what version do you using? have you the latest one (2.2.3)?
@magefan installed the last version, same error. If I write manually the date in the format 07/28/2016, it goes on.
@PierAlex could you also tell what locale is setted on your magento and what locale is in your browser?
@magefan Chrome
Magento
Maybe it can halps: in Magento standard modules, the date is not always displayed in the same way. E.g. in the order grid, the purchase date is mmm, dd,yyyy.,.. but if I edit an order the same date is in dd/mmm/yyyy format. For products, 'Set Product as New From' and 'to' dates are in the format mm/dd/yyyy and the calendar picker provide the date in this format. For catalog price rules, in the grid, the date fields displays dd/mmm/yyyy but in edit, dates are in mm/dd/yyyy and the calendar picker provide this format
So it appears that there is not a standard, or that a standard is not respected in Maento standard modules, to display dates but there is a standard for dates input (mm/dd/yyyy) that not consider locales. Calendar pickers provides the same format mm/dd/yyyy.
In your case, the calendar provides tha date in the format dd/mm/yyyy that is correct for locale input but not for Magento standard.
For query filters such as orders reporting, the picker provide the date in the dd/mm/yyyy but those fields doesn't need to be saved.
Ale
I just added an issue for magento. I think this is a Magento Issue. For a workaround it may be useful to have the picker in the Magento "standard" input format (mm/dd/yyyy) and an additional label that tells who inserts posts that the format for the date is mm/dd/yyyy to avoid wrong insertions (for dd<=12).
YATB
Having the same problem on Magento 2.1.0. Any updates on this?
@PieterCappelle, cannot replicate this issue on own test environments. Could you please contact us (http://magefan.com/contact/), so we can check on your side, and provide a solution for the community?
app\code[Developer][YourModule]\etc\adminhtml\events.xml:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="magefan_blog_post_edit_tab_main_prepare_form">
<observer name="[Developer]_[YourModule]_Observer_BlogPrepareForm" instance="[Developer]\[YourModule]\Observer\BlogPrepareForm" />
</event>
</config>
app\code[Developer][YourModule]\Observer\BlogPrepareForm.php:
<?php
namespace [Developer]\[YourModule]\Observer;
class BlogPrepareForm implements \Magento\Framework\Event\ObserverInterface
{
public function execute(\Magento\Framework\Event\Observer $observer)
{
/* @var \Magento\Framework\Data\Form $form*/
$form = $observer->getEvent()->getForm();
// Loop through form elements and set publish_time format to US
foreach($form->getElements() as $fieldset)
{
foreach($fieldset->getElements() as $input)
{
if($input instanceof \Magento\Framework\Data\Form\Element\Date)
{
$input->setDateFormat('MM/dd/y');
}
}
}
}
}
I've tried the fix above but am now getting:
Something went wrong while saving this posts. DateTime::__construct(): Failed to parse time string (0,9/1,7/2,016) at position 0 (0): Unexpected character
@woakley, a few date/locale issues were resolved in Magento2 #6323. If you patch-in that fix, and undo the one above, do blog dates work again?
We close this issue, as there was no new replies for a long time.
Experiencing this issue also in MG2.1.0. When trying to save/publish a blogpost, the datepicker adheres to the GB time, but then says "Please enter a valid date." as a message and won't save. If I type in the date in Americanized format, it then saves.
Is there any temporary solution until a proper fix at all?
@RForster92 , are you using blog extension greater 2.3.0? Can't replicate it on v2.4.2
We are using v2.2.0 of the blog extension on version 2.1.0 of Magento2
@RForster92 , please update blog extension to the newest version (current newest version is 2.4.3). Beginning from version 2.3.0 our blog extension use new ui for admin forms, so the issue must gone.
Hi,
Update blog is not working Magento 2.1.12, Magefan Blog 2.8.0
@kennedyabitbol , from what blog version you trying to update to v2.8.0 ?
hi @magefan I already got 2.8.0 installed
Hi, My locale input format is dd/mm/yyyy Calendar picker for the 'publish at' date insert the date correctly (dd/mm/yyyy). Magento need the date in the mm/dd/yyyy date. The problem is in Magento; however, is there a workaround to solve it? Thanks.