-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Fixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 release
Description
Preconditions
- PHP 7.0.22
- MySql 5.7
- Apache 2.4
- Magento 2.2.0
Steps to reproduce
- Login to frontend
- Edit Customer information
Expected result
- The year of birth date should be in the format: yyyy.
Actual result
- The actual format is yy
To fix the issue
To solve the issue have to modify the file:
vendor\magento\module-customer\Block\Widget\Dob.php
Actually the line 113 is:
$data['format'] = $this->getDateFormat();
(that return MM/dd/yy format in English locale)
This format is good for javascript datepicker configuration but it is wrong for the form input text.
I wrote a method that return the correct date format:
protected function getDateFormatForInput()
{
$formatArr = explode(' ', preg_replace("/[^a-zA-Z]/",' ',$this->getDateFormat())) ;
$reseteFormat = array();
foreach($formatArr as $k){
if($k != ''){
if(substr($k,0,1) == 'y' ){
$reseteFormat[] = 'yyyy';
} else {
$reseteFormat[] = $k;
}
}
}
return implode("/", $reseteFormat);
}
the new 113 line:
$data['format'] = $this->getDateFormatForInput();
Obviously this is my code though not very elegant, but it solves the problem.
Metadata
Metadata
Assignees
Labels
Fixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 release