File tree 1 file changed +9
-8
lines changed
app/code/Magento/Security/Model/UserExpiration 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change 16
16
*/
17
17
class Validator extends AbstractValidator
18
18
{
19
- /**@var \Magento\Framework\Stdlib\DateTime\DateTime */
20
- private $ dateTime ;
19
+
20
+ /**@var \Magento\Framework\Stdlib\DateTime\TimezoneInterface */
21
+ private $ timezone ;
21
22
22
23
/**
23
24
* Validator constructor.
24
25
*
25
- * @param \Magento\Framework\Stdlib\DateTime\DateTime $dateTime
26
+ * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $timezone
26
27
*/
27
28
public function __construct (
28
- \Magento \Framework \Stdlib \DateTime \DateTime $ dateTime
29
+ \Magento \Framework \Stdlib \DateTime \TimezoneInterface $ timezone
29
30
) {
30
-
31
- $ this ->dateTime = $ dateTime ;
31
+ $ this ->timezone = $ timezone ;
32
32
}
33
33
34
34
/**
@@ -45,8 +45,9 @@ public function isValid($value)
45
45
$ expiresAt = $ value ;
46
46
$ label = 'Expiration date ' ;
47
47
if (\Zend_Validate::is ($ expiresAt , 'NotEmpty ' )) {
48
- $ currentTime = $ this ->dateTime ->gmtTimestamp ();
49
- $ expiresAt = $ this ->dateTime ->gmtTimestamp ($ value );
48
+ $ currentTime = $ this ->timezone ->date ()->getTimestamp ();
49
+ $ utcExpiresAt = $ this ->timezone ->convertConfigTimeToUtc ($ expiresAt );
50
+ $ expiresAt = $ this ->timezone ->date ($ utcExpiresAt )->getTimestamp ();
50
51
if ($ expiresAt < $ currentTime ) {
51
52
$ messages ['expires_at ' ] = __ ('"%1" must be later than the current date. ' , $ label );
52
53
}
You can’t perform that action at this time.
0 commit comments