File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
app/code/Magento/Customer/Plugin Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 1313use Magento \Eav \Model \Config as EavConfig ;
1414use Magento \Framework \Exception \InputException ;
1515use Magento \Framework \Serialize \Serializer \Json as JsonSerializer ;
16+ use Magento \Framework \Stdlib \DateTime ;
1617
1718class ValidateDobOnSave
1819{
@@ -86,13 +87,19 @@ public function aroundSave(
8687 $ minDate = $ this ->parseDate ($ min );
8788 $ maxDate = $ this ->parseDate ($ max );
8889
89- $ dobKey = $ dobDate ->format (' Y-m-d ' );
90+ $ dobKey = $ dobDate ->format (DateTime:: DATE_PHP_FORMAT );
9091
91- if ($ minDate && $ dobKey < $ minDate ->format ('Y-m-d ' )) {
92- throw new InputException (__ ('Date of Birth must be on or after %1. ' , $ minDate ->format ('Y-m-d ' )));
92+ if ($ minDate && $ dobKey < $ minDate ->format (DateTime::DATE_PHP_FORMAT )) {
93+ throw new InputException (__ (
94+ 'Date of Birth must be on or after %1. ' ,
95+ $ minDate ->format (DateTime::DATE_PHP_FORMAT )
96+ ));
9397 }
94- if ($ maxDate && $ dobKey > $ maxDate ->format ('Y-m-d ' )) {
95- throw new InputException (__ ('Date of Birth must be on or before %1. ' , $ maxDate ->format ('Y-m-d ' )));
98+ if ($ maxDate && $ dobKey > $ maxDate ->format (DateTime::DATE_PHP_FORMAT )) {
99+ throw new InputException (__ (
100+ 'Date of Birth must be on or before %1. ' ,
101+ $ maxDate ->format (DateTime::DATE_PHP_FORMAT )
102+ ));
96103 }
97104 }
98105
You can’t perform that action at this time.
0 commit comments