1// Copyright 2023 The Gitea Authors. All rights reserved.
2// SPDX-License-Identifier: MIT
3
4package setting
5
6import (
7 "time"
8
9 "forgejo.org/modules/log"
10)
11
12// DefaultUILocation is the location on the UI, so that we can display the time on UI.
13var DefaultUILocation = time.Local
14
15func loadTimeFrom(rootCfg ConfigProvider) {
16 zone := rootCfg.Section("time").Key("DEFAULT_UI_LOCATION").String()
17 if zone != "" {
18 var err error
19 DefaultUILocation, err = time.LoadLocation(zone)
20 if err != nil {
21 log.Fatal("Load time zone failed: %v", err)
22 }
23 }
24 if DefaultUILocation == nil {
25 DefaultUILocation = time.Local
26 }
27}