修复管理员新建用户后查看未登录过的用户时出错的问题

*问题是后加的XX day ago功能导致
This commit is contained in:
Chenx221 2024-04-22 18:55:26 +08:00
parent 20e25b7441
commit ddb076cf31
Signed by: chenx221
GPG Key ID: D7A9EC07024C3021

View File

@ -86,7 +86,10 @@ $this->registerCssFile('@web/css/admin-userv.css');
}],
['attribute' => 'last_login', 'label' => '最后登录时间', 'value' => function ($model) {
// 日期时间 (xx天前)
if($model->last_login !== null){
return $model->last_login . ' (' . Yii::$app->formatter->asRelativeTime(new DateTime($model->last_login, new DateTimeZone('GMT+8'))) . ')';
}
return $model->last_login;
}],
['attribute' => 'last_login_ip', 'label' => '上次登录IP', 'value' => function ($model) use ($IPLocation) {
if (Yii::$app->params['enableIpInfo']) {