Skip to content

Commit 721b43a

Browse files
committed
Merge remote-tracking branch 'origin/AC-12025' into Hammer_248beta1_Scope03072024
2 parents 92b8231 + aa92c07 commit 721b43a

File tree

4 files changed

+22
-6
lines changed

4 files changed

+22
-6
lines changed

app/code/Magento/Customer/Block/Widget/Dob.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ class Dob extends AbstractWidget
2323
/**
2424
* Constants for borders of date-type customer attributes
2525
*/
26-
const MIN_DATE_RANGE_KEY = 'date_range_min';
26+
public const MIN_DATE_RANGE_KEY = 'date_range_min';
2727

28-
const MAX_DATE_RANGE_KEY = 'date_range_max';
28+
public const MAX_DATE_RANGE_KEY = 'date_range_max';
2929

3030
/**
3131
* @var array
@@ -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
}

app/code/Magento/Customer/Test/Unit/Block/Widget/DobTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class DobTest extends TestCase
5252
private const YEAR = '2014';
5353

5454
// Value of date('Y', strtotime(self::DATE))
55-
private const DATE_FORMAT = 'M/dd/y';
55+
private const DATE_FORMAT = 'MM/dd/y';
5656

5757
/** Constants used by Dob::setDateInput($code, $html) */
5858
private const DAY_HTML =

dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/validation.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ define([
1616

1717
dataProvider = [
1818
{
19-
format: 'M/d/Y',
19+
format: 'MM/d/Y',
2020
date: '09/2/18',
2121
expects: true
2222
},

lib/web/moment.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)