@@ -9,45 +9,10 @@ import (
99 "code.gitea.io/gitea/modules/log"
1010)
1111
12- var (
13- // Time settings
14- TimeFormat string
15- // UILocation is the location on the UI, so that we can display the time on UI.
16- DefaultUILocation = time .Local
17- )
12+ // DefaultUILocation is the location on the UI, so that we can display the time on UI.
13+ var DefaultUILocation = time .Local
1814
1915func loadTimeFrom (rootCfg ConfigProvider ) {
20- timeFormatKey := rootCfg .Section ("time" ).Key ("FORMAT" ).MustString ("" )
21- if timeFormatKey != "" {
22- TimeFormat = map [string ]string {
23- "ANSIC" : time .ANSIC ,
24- "UnixDate" : time .UnixDate ,
25- "RubyDate" : time .RubyDate ,
26- "RFC822" : time .RFC822 ,
27- "RFC822Z" : time .RFC822Z ,
28- "RFC850" : time .RFC850 ,
29- "RFC1123" : time .RFC1123 ,
30- "RFC1123Z" : time .RFC1123Z ,
31- "RFC3339" : time .RFC3339 ,
32- "RFC3339Nano" : time .RFC3339Nano ,
33- "Kitchen" : time .Kitchen ,
34- "Stamp" : time .Stamp ,
35- "StampMilli" : time .StampMilli ,
36- "StampMicro" : time .StampMicro ,
37- "StampNano" : time .StampNano ,
38- }[timeFormatKey ]
39- // When the TimeFormatKey does not exist in the previous map e.g.'2006-01-02 15:04:05'
40- if len (TimeFormat ) == 0 {
41- TimeFormat = timeFormatKey
42- TestTimeFormat , _ := time .Parse (TimeFormat , TimeFormat )
43- if TestTimeFormat .Format (time .RFC3339 ) != "2006-01-02T15:04:05Z" {
44- log .Warn ("Provided TimeFormat: %s does not create a fully specified date and time." , TimeFormat )
45- log .Warn ("In order to display dates and times correctly please check your time format has 2006, 01, 02, 15, 04 and 05" )
46- }
47- log .Trace ("Custom TimeFormat: %s" , TimeFormat )
48- }
49- }
50-
5116 zone := rootCfg .Section ("time" ).Key ("DEFAULT_UI_LOCATION" ).String ()
5217 if zone != "" {
5318 var err error
0 commit comments