File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
app/code/Magento/Customer Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -303,6 +303,7 @@ public function getHtmlExtraParams()
303303 public function getDateFormat ()
304304 {
305305 $ dateFormat = $ this ->setTwoDayPlaces ($ this ->_localeDate ->getDateFormatWithLongYear ());
306+ $ dateFormat = $ this ->setTwoMonthPlaces ($ dateFormat );
306307 /** Escape RTL characters which are present in some locales and corrupt formatting */
307308 $ escapedDateFormat = preg_replace ('/[^MmDdYy\/\.\-]/ ' , '' , $ dateFormat );
308309
@@ -440,4 +441,19 @@ private function setTwoDayPlaces(string $format): string
440441 $ format
441442 );
442443 }
444+
445+ /**
446+ * Set 2 places for month value in format string
447+ *
448+ * @param string $format
449+ * @return string
450+ */
451+ private function setTwoMonthPlaces (string $ format ): string
452+ {
453+ return preg_replace (
454+ '/(?<!M)M(?!M)/ ' ,
455+ 'MM ' ,
456+ $ format
457+ );
458+ }
443459}
Original file line number Diff line number Diff line change @@ -11,10 +11,8 @@ define([
1111 $ . validator . addMethod (
1212 'validate-date' ,
1313 function ( value , element , params ) {
14- if ( params . dateFormat === 'M/dd/y' ) {
15- params . dateFormat = 'MM/dd/y' ;
16- }
1714 var dateFormat = utils . normalizeDate ( params . dateFormat ) ;
15+
1816 if ( value === '' ) {
1917 return true ;
2018 }
You can’t perform that action at this time.
0 commit comments