fix comparing time of signing in
This commit is contained in:
parent
9ff5bbfcaa
commit
47c758c5c0
|
|
@ -304,9 +304,15 @@ class User extends Model
|
|||
public function getSignInRemainingTime()
|
||||
{
|
||||
// convert to timestamp
|
||||
$lastSignInTime = strtotime($this->getLastSignInTime());
|
||||
$lastSignInTime = Carbon::parse($this->getLastSignInTime());
|
||||
|
||||
return option('sign_after_zero') ? (Carbon::tomorrow()->timestamp - time()) : ($lastSignInTime + option('sign_gap_time') * 3600 - time());
|
||||
if (option('sign_after_zero')) {
|
||||
return Carbon::now()->diffInSeconds(
|
||||
(($lastSignInTime <= Carbon::today()) ? $lastSignInTime : Carbon::tomorrow())
|
||||
, false);
|
||||
}
|
||||
|
||||
return $lastSignInTime->addSeconds(option('sign_gap_time') * 3600)->diffInSeconds(Carbon::now());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Services;
|
||||
|
||||
use Log;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
use Storage as LaravelStorage;
|
||||
use App\Exceptions\PrettyPageException;
|
||||
|
|
@ -209,7 +210,7 @@ class Utils
|
|||
|
||||
public static function getTimeFormatted($timestamp = 0)
|
||||
{
|
||||
return ($timestamp == 0) ? date('Y-m-d H:i:s') : date('Y-m-d H:i:s', $timestamp);
|
||||
return ($timestamp == 0) ? Carbon::now()->toDateTimeString() : Carbon::createFromTimestamp($timestamp)->toDateTimeString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user