1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-31 18:31:01 +00:00

Show last login and session creation date in current timezone

This commit is contained in:
Frédéric Guillot 2018-03-04 17:04:31 -08:00
parent 5185bf0c7e
commit 609c57332e
6 changed files with 41 additions and 6 deletions

View file

@ -7,6 +7,8 @@ package model
import (
"errors"
"time"
"github.com/miniflux/miniflux/timezone"
)
// User represents a user in the system.
@ -99,5 +101,19 @@ func (u *User) Merge(override *User) {
}
}
// UseTimezone converts last login date to the given timezone.
func (u *User) UseTimezone(tz string) {
if u.LastLoginAt != nil {
*u.LastLoginAt = timezone.Convert(tz, *u.LastLoginAt)
}
}
// Users represents a list of users.
type Users []*User
// UseTimezone converts last login timestamp of all users to the given timezone.
func (u Users) UseTimezone(tz string) {
for _, user := range u {
user.UseTimezone(tz)
}
}