From f94c1b3943ebc4249e6240855c5414f735e8b25f Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 14 Dec 2017 07:45:31 +0800 Subject: Improvements for supporting UI Location (#3146) * improvements for supporting UI Location * improved the comment --- modules/util/time_stamp.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'modules/util') diff --git a/modules/util/time_stamp.go b/modules/util/time_stamp.go index 4a12a2cabe..a03560b24f 100644 --- a/modules/util/time_stamp.go +++ b/modules/util/time_stamp.go @@ -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 } -- cgit v1.2.3