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()
281
281
*/
282
282
public function getDateFormat ()
283
283
{
284
- $ dateFormat = $ this ->_localeDate ->getDateFormatWithLongYear ();
284
+ $ dateFormat = $ this ->setTwoDayPlaces ( $ this -> _localeDate ->getDateFormatWithLongYear () );
285
285
/** Escape RTL characters which are present in some locales and corrupt formatting */
286
286
$ escapedDateFormat = preg_replace ('/[^MmDdYy\/\.\-]/ ' , '' , $ dateFormat );
287
287
@@ -377,4 +377,19 @@ public function getFirstDay()
377
377
\Magento \Store \Model \ScopeInterface::SCOPE_STORE
378
378
);
379
379
}
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
+ }
380
395
}
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ class DobTest extends TestCase
51
51
const YEAR = '2014 ' ;
52
52
53
53
// Value of date('Y', strtotime(self::DATE))
54
- const DATE_FORMAT = 'M/d /y ' ;
54
+ const DATE_FORMAT = 'M/dd /y ' ;
55
55
56
56
/** Constants used by Dob::setDateInput($code, $html) */
57
57
const DAY_HTML =
@@ -356,11 +356,15 @@ public function getDateFormatDataProvider(): array
356
356
[
357
357
'ar_SA ' ,
358
358
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
+ )
364
368
)
365
369
],
366
370
[Resolver::DEFAULT_LOCALE , self ::DATE_FORMAT ],
You can’t perform that action at this time.
0 commit comments