diff --git a/app/code/Magento/Customer/Test/Unit/Block/Widget/DobTest.php b/app/code/Magento/Customer/Test/Unit/Block/Widget/DobTest.php index 1fd7fc340e542..d793b864e0e79 100644 --- a/app/code/Magento/Customer/Test/Unit/Block/Widget/DobTest.php +++ b/app/code/Magento/Customer/Test/Unit/Block/Widget/DobTest.php @@ -48,7 +48,7 @@ class DobTest extends TestCase const YEAR = '2014'; // Value of date('Y', strtotime(self::DATE)) - const DATE_FORMAT = 'M/d/Y'; + const DATE_FORMAT = 'M/dd/Y'; /** Constants used by Dob::setDateInput($code, $html) */ const DAY_HTML = @@ -357,8 +357,8 @@ public function getDateFormatDataProvider(): array [ 'ar_SA', preg_replace( - '/[^MmDdYy\/\.\-]/', - '', + ['/[^MmDdYy\/\.\-]/','/d+/'], + ['','dd'], (new \IntlDateFormatter('ar_SA', \IntlDateFormatter::SHORT, \IntlDateFormatter::NONE)) ->getPattern() ) @@ -544,8 +544,8 @@ public function testGetHtmlExtraParamsWithoutRequiredOption() { $this->escaper->expects($this->any()) ->method('escapeHtml') - ->with('{"validate-date":{"dateFormat":"M\/d\/Y"},"validate-dob":true}') - ->will($this->returnValue('{"validate-date":{"dateFormat":"M\/d\/Y"},"validate-dob":true}')); + ->with('{"validate-date":{"dateFormat":"M\/dd\/Y"},"validate-dob":true}') + ->will($this->returnValue('{"validate-date":{"dateFormat":"M\/dd\/Y"},"validate-dob":true}')); $this->attribute->expects($this->once()) ->method("isRequired") @@ -553,7 +553,7 @@ public function testGetHtmlExtraParamsWithoutRequiredOption() $this->assertEquals( $this->_block->getHtmlExtraParams(), - 'data-validate="{"validate-date":{"dateFormat":"M\/d\/Y"},"validate-dob":true}"' + 'data-validate="{"validate-date":{"dateFormat":"M\/dd\/Y"},"validate-dob":true}"' ); } @@ -567,17 +567,17 @@ public function testGetHtmlExtraParamsWithRequiredOption() ->willReturn(true); $this->escaper->expects($this->any()) ->method('escapeHtml') - ->with('{"required":true,"validate-date":{"dateFormat":"M\/d\/Y"},"validate-dob":true}') + ->with('{"required":true,"validate-date":{"dateFormat":"M\/dd\/Y"},"validate-dob":true}') ->will( $this->returnValue( - '{"required":true,"validate-date":{"dateFormat":"M\/d\/Y"},"validate-dob":true}' + '{"required":true,"validate-date":{"dateFormat":"M\/dd\/Y"},"validate-dob":true}' ) ); $this->context->expects($this->any())->method('getEscaper')->will($this->returnValue($this->escaper)); $this->assertEquals( - 'data-validate="{"required":true,"validate-date":{"dateFormat":"M\/d\/Y"},"validate-dob":true}"', + 'data-validate="{"required":true,"validate-date":{"dateFormat":"M\/dd\/Y"},"validate-dob":true}"', $this->_block->getHtmlExtraParams() ); } diff --git a/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php b/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php index 0791c89ab793a..0b6d84beb5951 100644 --- a/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php +++ b/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php @@ -130,8 +130,8 @@ public function getDateFormat($type = \IntlDateFormatter::SHORT) public function getDateFormatWithLongYear() { return preg_replace( - '/(?getDateFormat() ); }