mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-18 07:53:04 +00:00
Improvements for supporting UI Location (#3146)
* improvements for supporting UI Location * improved the comment
This commit is contained in:
parent
b6d2243ac0
commit
f94c1b3943
7 changed files with 28 additions and 25 deletions
|
@ -4,7 +4,11 @@
|
|||
|
||||
package util
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"time"
|
||||
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
)
|
||||
|
||||
// TimeStamp defines a timestamp
|
||||
type TimeStamp int64
|
||||
|
@ -31,13 +35,13 @@ func (ts TimeStamp) Year() int {
|
|||
|
||||
// AsTime convert timestamp as time.Time in Local locale
|
||||
func (ts TimeStamp) AsTime() (tm time.Time) {
|
||||
tm = time.Unix(int64(ts), 0).Local()
|
||||
tm = time.Unix(int64(ts), 0).In(setting.UILocation)
|
||||
return
|
||||
}
|
||||
|
||||
// AsTimePtr convert timestamp as *time.Time in Local locale
|
||||
func (ts TimeStamp) AsTimePtr() *time.Time {
|
||||
tm := time.Unix(int64(ts), 0).Local()
|
||||
tm := time.Unix(int64(ts), 0).In(setting.UILocation)
|
||||
return &tm
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue