-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'Publish at' date format after upgrade from 2.07 to 2.10 is correct but cannot be saved #30
Comments
@PierAlex what version do you using? have you the latest one (2.2.3)? |
@magefan |
@PierAlex could you also tell what locale is setted on your magento and what locale is in your browser? |
@magefan Maybe it can halps: 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? |
Preconditions
Steps to reproduce
Expected result
Actual resultCause
Solution
|
Temporary solutionapp\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:
|
@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). |
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 |
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.
The text was updated successfully, but these errors were encountered: