Skip to content

Commit 100f2c5

Browse files
committed
rename UILocation to DefaultUILocation
1 parent c9ba362 commit 100f2c5

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

custom/conf/app.ini.sample

+1-1
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ MAX_FILES = 5
549549
FORMAT =
550550
; Location the UI time display i.e. Asia/Shanghai
551551
; Empty means server's location setting
552-
UI_LOCATION =
552+
DEFAULT_UI_LOCATION =
553553

554554
[log]
555555
ROOT_PATH =

docs/content/doc/advanced/config-cheat-sheet.en-us.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ Two special environment variables are passed to the render command:
505505

506506
## Time (`time`)
507507
- `FORMAT`: Time format to diplay on UI. i.e. RFC1123 or 2006-01-02 15:04:05
508-
- `UI_LOCATION`: Location of time on the UI, so that we can display correct user's time on UI. i.e. Shanghai/Asia
508+
- `DEFAULT_UI_LOCATION`: Default location of time on the UI, so that we can display correct user's time on UI. i.e. Shanghai/Asia
509509

510510
## Other (`other`)
511511

docs/content/doc/advanced/config-cheat-sheet.zh-cn.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ IS_INPUT_FILE = false
239239

240240
## Time (`time`)
241241
- `FORMAT`: 显示在界面上的时间格式。比如: RFC1123 或者 2006-01-02 15:04:05
242-
- `UI_LOCATION`: 显示在界面上的时区,默认为本地时区。比如: Asia/Shanghai
242+
- `DEFAULT_UI_LOCATION`: 默认显示在界面上的时区,默认为本地时区。比如: Asia/Shanghai
243243

244244
## Other (`other`)
245245

models/issue_tracked_time.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ type TrackedTime struct {
2626

2727
// AfterLoad is invoked from XORM after setting the values of all fields of this object.
2828
func (t *TrackedTime) AfterLoad() {
29-
t.Created = time.Unix(t.CreatedUnix, 0).In(setting.UILocation)
29+
t.Created = time.Unix(t.CreatedUnix, 0).In(setting.DefaultUILocation)
3030
}
3131

3232
// APIFormat converts TrackedTime to API format

modules/base/tool.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ func TimeSince(then time.Time, lang string) template.HTML {
399399

400400
func htmlTimeSince(then, now time.Time, lang string) template.HTML {
401401
return template.HTML(fmt.Sprintf(`<span class="time-since" title="%s">%s</span>`,
402-
then.In(setting.UILocation).Format(setting.TimeFormat),
402+
then.In(setting.DefaultUILocation).Format(setting.TimeFormat),
403403
timeSince(then, now, lang)))
404404
}
405405

@@ -410,7 +410,7 @@ func TimeSinceUnix(then util.TimeStamp, lang string) template.HTML {
410410

411411
func htmlTimeSinceUnix(then, now util.TimeStamp, lang string) template.HTML {
412412
return template.HTML(fmt.Sprintf(`<span class="time-since" title="%s">%s</span>`,
413-
then.FormatInLocation(setting.TimeFormat, setting.UILocation),
413+
then.FormatInLocation(setting.TimeFormat, setting.DefaultUILocation),
414414
timeSinceUnix(int64(then), int64(now), lang)))
415415
}
416416

modules/migrations/gitea.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func (g *GiteaLocalUploader) CreateMilestones(milestones ...*base.Milestone) err
111111
deadline = util.TimeStamp(milestone.Deadline.Unix())
112112
}
113113
if deadline == 0 {
114-
deadline = util.TimeStamp(time.Date(9999, 1, 1, 0, 0, 0, 0, setting.UILocation).Unix())
114+
deadline = util.TimeStamp(time.Date(9999, 1, 1, 0, 0, 0, 0, setting.DefaultUILocation).Unix())
115115
}
116116
var ms = models.Milestone{
117117
RepoID: g.repo.ID,

modules/setting/setting.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ var (
279279
// Time settings
280280
TimeFormat string
281281
// UILocation is the location on the UI, so that we can display the time on UI.
282-
UILocation = time.Local
282+
DefaultUILocation = time.Local
283283

284284
CSRFCookieName = "_csrf"
285285
CSRFCookieHTTPOnly = true
@@ -818,15 +818,15 @@ func NewContext() {
818818
log.Trace("Custom TimeFormat: %s", TimeFormat)
819819
}
820820

821-
zone := Cfg.Section("time").Key("UI_LOCATION").String()
821+
zone := Cfg.Section("time").Key("DEFAULT_UI_LOCATION").String()
822822
if zone != "" {
823-
UILocation, err = time.LoadLocation(zone)
823+
DefaultUILocation, err = time.LoadLocation(zone)
824824
if err != nil {
825825
log.Fatal("Load time zone failed: %v", err)
826826
}
827827
}
828-
if UILocation == nil {
829-
UILocation = time.Local
828+
if DefaultUILocation == nil {
829+
DefaultUILocation = time.Local
830830
}
831831

832832
RunUser = Cfg.Section("").Key("RUN_USER").MustString(user.CurrentUsername())

modules/util/time_stamp.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func (ts TimeStamp) Year() int {
3535

3636
// AsTime convert timestamp as time.Time in Local locale
3737
func (ts TimeStamp) AsTime() (tm time.Time) {
38-
return ts.AsTimeInLocation(setting.UILocation)
38+
return ts.AsTimeInLocation(setting.DefaultUILocation)
3939
}
4040

4141
// AsTimeInLocation convert timestamp as time.Time in Local locale
@@ -46,7 +46,7 @@ func (ts TimeStamp) AsTimeInLocation(loc *time.Location) (tm time.Time) {
4646

4747
// AsTimePtr convert timestamp as *time.Time in Local locale
4848
func (ts TimeStamp) AsTimePtr() *time.Time {
49-
return ts.AsTimePtrInLocation(setting.UILocation)
49+
return ts.AsTimePtrInLocation(setting.DefaultUILocation)
5050
}
5151

5252
// AsTimePtrInLocation convert timestamp as *time.Time in customize location
@@ -57,7 +57,7 @@ func (ts TimeStamp) AsTimePtrInLocation(loc *time.Location) *time.Time {
5757

5858
// Format formats timestamp as given format
5959
func (ts TimeStamp) Format(f string) string {
60-
return ts.FormatInLocation(f, setting.UILocation)
60+
return ts.FormatInLocation(f, setting.DefaultUILocation)
6161
}
6262

6363
// FormatInLocation formats timestamp as given format with spiecific location

0 commit comments

Comments
 (0)