修复错误的日期时间差计算
This commit is contained in:
parent
fefd880e43
commit
42344ec3f1
@ -41,7 +41,7 @@ $this->title = '登录日志';
|
||||
'format' => 'html',
|
||||
'enableSorting' => false,
|
||||
'value' => function ($model) {
|
||||
return nl2br($model->login_time . "\n(" . Yii::$app->formatter->asRelativeTime($model->login_time) . ")");
|
||||
return nl2br($model->login_time . "\n(" . Yii::$app->formatter->asRelativeTime(new DateTime($model->login_time, new DateTimeZone('GMT+8'))) . ")");
|
||||
},
|
||||
],
|
||||
[
|
||||
|
@ -83,11 +83,11 @@ $this->registerCssFile('@web/css/admin-userv.css');
|
||||
}],
|
||||
['attribute' => 'created_at', 'label' => '创建时间', 'value' => function ($model) {
|
||||
// 日期时间 (xx天前)
|
||||
return $model->created_at . ' (' . Yii::$app->formatter->asRelativeTime($model->created_at) . ')';
|
||||
return $model->created_at . ' (' . Yii::$app->formatter->asRelativeTime(new DateTime($model->created_at, new DateTimeZone('GMT+8'))) . ')';
|
||||
}],
|
||||
['attribute' => 'last_login', 'label' => '最后登录时间', 'value' => function ($model) {
|
||||
// 日期时间 (xx天前)
|
||||
return $model->last_login . ' (' . Yii::$app->formatter->asRelativeTime($model->last_login) . ')';
|
||||
return $model->last_login . ' (' . Yii::$app->formatter->asRelativeTime(new DateTime($model->last_login, new DateTimeZone('GMT+8'))) . ')';
|
||||
}],
|
||||
['attribute' => 'last_login_ip', 'label' => '上次登录IP', 'value' => function ($model) use ($IPLocation) {
|
||||
if (Yii::$app->params['enableIpInfo']) {
|
||||
|
Loading…
Reference in New Issue
Block a user