@@ -348,15 +348,17 @@ public function getStoreLastLoginDateTimezone()
348
348
*/
349
349
public function getCurrentStatus ()
350
350
{
351
+ $ lastLoginTime = $ this ->getCustomerLog ()->getLastLoginAt ();
352
+
351
353
// Customer has never been logged in.
352
- if (!$ this -> getCustomerLog ()-> getLastLoginAt () ) {
354
+ if (!$ lastLoginTime ) {
353
355
return __ ('Offline ' );
354
356
}
355
357
358
+ $ lastLogoutTime = $ this ->getCustomerLog ()->getLastLogoutAt ();
359
+
356
360
// Customer clicked 'Log Out' link\button.
357
- if ($ this ->getCustomerLog ()->getLastLogoutAt () &&
358
- strtotime ($ this ->getCustomerLog ()->getLastLogoutAt ()) > strtotime ($ this ->getCustomerLog ()->getLastLoginAt ())
359
- ) {
361
+ if ($ lastLogoutTime && strtotime ($ lastLogoutTime ) > strtotime ($ lastLoginTime )) {
360
362
return __ ('Offline ' );
361
363
}
362
364
@@ -365,8 +367,7 @@ public function getCurrentStatus()
365
367
$ currentTimestamp = (new \DateTime ())->getTimestamp ();
366
368
$ lastVisitTime = $ this ->getCustomerLog ()->getLastVisitAt ();
367
369
368
- if ($ lastVisitTime && $ currentTimestamp - strtotime ($ lastVisitTime ) > $ interval * 60
369
- ) {
370
+ if ($ lastVisitTime && $ currentTimestamp - strtotime ($ lastVisitTime ) > $ interval * 60 ) {
370
371
return __ ('Offline ' );
371
372
}
372
373
@@ -383,7 +384,7 @@ public function getLastLoginDate()
383
384
$ date = $ this ->getCustomerLog ()->getLastLoginAt ();
384
385
385
386
if ($ date ) {
386
- return $ this ->formatDate ($ date , TimezoneInterface:: FORMAT_TYPE_MEDIUM , true );
387
+ return $ this ->formatDate ($ date , \IntlDateFormatter:: MEDIUM , true );
387
388
}
388
389
389
390
return __ ('Never ' );
@@ -400,7 +401,7 @@ public function getStoreLastLoginDate()
400
401
401
402
if ($ date ) {
402
403
$ date = $ this ->_localeDate ->scopeDate ($ this ->getCustomer ()->getStoreId (), $ date , true );
403
- return $ this ->formatDate ($ date , TimezoneInterface:: FORMAT_TYPE_MEDIUM , true );
404
+ return $ this ->formatDate ($ date , \IntlDateFormatter:: MEDIUM , true );
404
405
}
405
406
406
407
return __ ('Never ' );
0 commit comments