Skip to content

Commit c3587c2

Browse files
author
Robert He
committed
MAGETWO-68976: [Magento Cloud] Incorrect date format with Arabic language locale
- filter out any additional locale information besides MmDdYy and the separators (‘/‘,’.’,’-‘)
1 parent b3409c5 commit c3587c2

File tree

1 file changed

+4
-1
lines changed
  • app/code/Magento/Catalog/Block/Product/View/Options/Type

1 file changed

+4
-1
lines changed

app/code/Magento/Catalog/Block/Product/View/Options/Type/Date.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ public function getCalendarDateHtml()
8383

8484
$dateFormat = $this->_localeDate->getDateFormat(\IntlDateFormatter::SHORT);
8585
/** Escape RTL characters which are present in some locales and corrupt formatting */
86-
$escapedDateFormat = preg_replace('/[^[:print:]]/', '', $dateFormat);
86+
$patterns = [];
87+
$patterns[0] = '/[^[:print:]]/';
88+
$patterns[1] = '/[^MmDdYy\/\.\-]/';
89+
$escapedDateFormat = preg_replace($patterns, '', $dateFormat);
8790
$calendar = $this->getLayout()->createBlock(
8891
\Magento\Framework\View\Element\Html\Date::class
8992
)->setId(

0 commit comments

Comments
 (0)