File tree Expand file tree Collapse file tree 2 files changed +26
-7
lines changed
app/code/Magento/Customer Expand file tree Collapse file tree 2 files changed +26
-7
lines changed Original file line number Diff line number Diff line change @@ -281,7 +281,7 @@ public function getHtmlExtraParams()
281281 */
282282 public function getDateFormat ()
283283 {
284- $ dateFormat = $ this ->_localeDate ->getDateFormatWithLongYear ();
284+ $ dateFormat = $ this ->setTwoDayPlaces ( $ this -> _localeDate ->getDateFormatWithLongYear () );
285285 /** Escape RTL characters which are present in some locales and corrupt formatting */
286286 $ escapedDateFormat = preg_replace ('/[^MmDdYy\/\.\-]/ ' , '' , $ dateFormat );
287287
@@ -377,4 +377,19 @@ public function getFirstDay()
377377 \Magento \Store \Model \ScopeInterface::SCOPE_STORE
378378 );
379379 }
380+
381+ /**
382+ * Set 2 places for day value in format string
383+ *
384+ * @param string $format
385+ * @return string
386+ */
387+ private function setTwoDayPlaces (string $ format ): string
388+ {
389+ return preg_replace (
390+ '/(?<!d)d(?!d)/ ' ,
391+ 'dd ' ,
392+ $ format
393+ );
394+ }
380395}
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ class DobTest extends TestCase
5151 const YEAR = '2014 ' ;
5252
5353 // Value of date('Y', strtotime(self::DATE))
54- const DATE_FORMAT = 'M/d /y ' ;
54+ const DATE_FORMAT = 'M/dd /y ' ;
5555
5656 /** Constants used by Dob::setDateInput($code, $html) */
5757 const DAY_HTML =
@@ -356,11 +356,15 @@ public function getDateFormatDataProvider(): array
356356 [
357357 'ar_SA ' ,
358358 preg_replace (
359- '/[^MmDdYy\/\.\-]/ ' ,
360- '' ,
361- (new DateFormatterFactory ())
362- ->create ('ar_SA ' , \IntlDateFormatter::SHORT , \IntlDateFormatter::NONE )
363- ->getPattern ()
359+ '/(?<!d)d(?!d)/ ' ,
360+ 'dd ' ,
361+ preg_replace (
362+ '/[^MmDdYy\/\.\-]/ ' ,
363+ '' ,
364+ (new DateFormatterFactory ())
365+ ->create ('ar_SA ' , \IntlDateFormatter::SHORT , \IntlDateFormatter::NONE )
366+ ->getPattern ()
367+ )
364368 )
365369 ],
366370 [Resolver::DEFAULT_LOCALE , self ::DATE_FORMAT ],
You can’t perform that action at this time.
0 commit comments