summaryrefslogtreecommitdiffstats
path: root/modules/setting/time.go
diff options
context:
space:
mode:
authorYarden Shoham <git@yardenshoham.com>2023-04-29 23:51:43 +0300
committerGitHub <noreply@github.com>2023-04-29 22:51:43 +0200
commitcc84c58aff30281d7f3cc6baca80e6983e35c859 (patch)
treec741bba8dee929f78d774a63b0896571829b8b3f /modules/setting/time.go
parenta18919bba6e7f56572b782ce00285960accbde87 (diff)
downloadgitea-cc84c58aff30281d7f3cc6baca80e6983e35c859.tar.gz
gitea-cc84c58aff30281d7f3cc6baca80e6983e35c859.zip
Remove unused setting `time.FORMAT` (#24430)
It's loaded and then never used. --------- Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'modules/setting/time.go')
-rw-r--r--modules/setting/time.go39
1 files changed, 2 insertions, 37 deletions
diff --git a/modules/setting/time.go b/modules/setting/time.go
index 5fd0fdb92f..6d2aa80f5b 100644
--- a/modules/setting/time.go
+++ b/modules/setting/time.go
@@ -9,45 +9,10 @@ import (
"code.gitea.io/gitea/modules/log"
)
-var (
- // Time settings
- TimeFormat string
- // UILocation is the location on the UI, so that we can display the time on UI.
- DefaultUILocation = time.Local
-)
+// DefaultUILocation is the location on the UI, so that we can display the time on UI.
+var DefaultUILocation = time.Local
func loadTimeFrom(rootCfg ConfigProvider) {
- timeFormatKey := rootCfg.Section("time").Key("FORMAT").MustString("")
- if timeFormatKey != "" {
- TimeFormat = map[string]string{
- "ANSIC": time.ANSIC,
- "UnixDate": time.UnixDate,
- "RubyDate": time.RubyDate,
- "RFC822": time.RFC822,
- "RFC822Z": time.RFC822Z,
- "RFC850": time.RFC850,
- "RFC1123": time.RFC1123,
- "RFC1123Z": time.RFC1123Z,
- "RFC3339": time.RFC3339,
- "RFC3339Nano": time.RFC3339Nano,
- "Kitchen": time.Kitchen,
- "Stamp": time.Stamp,
- "StampMilli": time.StampMilli,
- "StampMicro": time.StampMicro,
- "StampNano": time.StampNano,
- }[timeFormatKey]
- // When the TimeFormatKey does not exist in the previous map e.g.'2006-01-02 15:04:05'
- if len(TimeFormat) == 0 {
- TimeFormat = timeFormatKey
- TestTimeFormat, _ := time.Parse(TimeFormat, TimeFormat)
- if TestTimeFormat.Format(time.RFC3339) != "2006-01-02T15:04:05Z" {
- log.Warn("Provided TimeFormat: %s does not create a fully specified date and time.", TimeFormat)
- log.Warn("In order to display dates and times correctly please check your time format has 2006, 01, 02, 15, 04 and 05")
- }
- log.Trace("Custom TimeFormat: %s", TimeFormat)
- }
- }
-
zone := rootCfg.Section("time").Key("DEFAULT_UI_LOCATION").String()
if zone != "" {
var err error