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 13
13
use Magento \Eav \Model \Config as EavConfig ;
14
14
use Magento \Framework \Exception \InputException ;
15
15
use Magento \Framework \Serialize \Serializer \Json as JsonSerializer ;
16
+ use Magento \Framework \Stdlib \DateTime ;
16
17
17
18
class ValidateDobOnSave
18
19
{
@@ -86,13 +87,19 @@ public function aroundSave(
86
87
$ minDate = $ this ->parseDate ($ min );
87
88
$ maxDate = $ this ->parseDate ($ max );
88
89
89
- $ dobKey = $ dobDate ->format (' Y-m-d ' );
90
+ $ dobKey = $ dobDate ->format (DateTime:: DATE_PHP_FORMAT );
90
91
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
+ ));
93
97
}
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
+ ));
96
103
}
97
104
}
98
105
You can’t perform that action at this time.
0 commit comments