1

I have a store with Italian Language with Magento 2.3.0. In that store, I have created a calendar and I am facing some issue while selecting the date from the calendar.

My Date Format is dd/MM/yy. My expected out is "12 March 2019". But I am always getting this 12/03/2019.

    $dateFormat = $this->_localeDate->getDateFormat(\IntlDateFormatter::SHORT);
    $escapedDateFormat = preg_replace('/[^MmDdYy\/\.\-]/', '', $this->getDateFormat());
    $this->dateElement->setData([
        'extra_params' => $this->isRequired() ? 'data-validate="{required:true}"' : '',
        'name' => 'expired_date',
        'id' => 'expired_date',
        'class' => $this->getHtmlClass().'required-entry',
        'value' => $this->getRequiredDate(),
        'date_format' => $this->getDateFormatVals(),
        'image' => $this->getViewFileUrl('Magento_Theme::calendar.png'),
        'change_month' => 'true',
        'change_year' => 'true',
        'show_on' => 'both'
    ]);

Date picker

Now my issue is language(locale is working fine). But when I am selecting the date instead of 31/March/2019 Its showing 31/03/2019 . Could you please tell what is the exact issue .

0

Its a default Magento bug :

https://github.com/magento/magento2/pull/11156

To fix this issue you need to update the file :

vendor\magento\framework\Stdlib\DateTime\Filter\DateTime.php

Change line 46 as below

from :

$dateTime = $this->_localeDate->date($value, null, false);

To :

$dateTime = $this->_localeDate->date($value, null, false, false);
  • still same issue. Still coming as 20/03/2019 – Arjun Manoharan Mar 12 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.