diff options
author | Frédéric Guillot <fred@miniflux.net> | 2018-03-04 17:04:31 -0800 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2018-03-04 17:04:31 -0800 |
commit | 609c57332e73aa753d9c198cad3595cde501c1ff (patch) | |
tree | 8d7ce9e44d2f5f755d6a854ad10fee81b218b719 /model/user.go | |
parent | 5185bf0c7ea5522ee2b00d57e3954549b314553a (diff) |
Show last login and session creation date in current timezone
Diffstat (limited to 'model/user.go')
-rw-r--r-- | model/user.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/model/user.go b/model/user.go index aa1156d..d2283f1 100644 --- a/model/user.go +++ b/model/user.go @@ -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) + } +} |