Skip to content

Commit cc84c58

Browse files
Remove unused setting time.FORMAT (#24430)
It's loaded and then never used. --------- Co-authored-by: Giteabot <[email protected]>
1 parent a18919b commit cc84c58

File tree

4 files changed

+2
-76
lines changed

4 files changed

+2
-76
lines changed

custom/conf/app.example.ini

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,11 +1899,6 @@ ROUTER = console
18991899
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
19001900
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
19011901
;;
1902-
;; Specifies the format for fully outputted dates. Defaults to RFC1123
1903-
;; Special supported values are ANSIC, UnixDate, RubyDate, RFC822, RFC822Z, RFC850, RFC1123, RFC1123Z, RFC3339, RFC3339Nano, Kitchen, Stamp, StampMilli, StampMicro and StampNano
1904-
;; For more information about the format see http://golang.org/pkg/time/#pkg-constants
1905-
;FORMAT =
1906-
;;
19071902
;; Location the UI time display i.e. Asia/Shanghai
19081903
;; Empty means server's location setting
19091904
;DEFAULT_UI_LOCATION =

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,6 @@ in this mapping or the filetype using heuristics.
12071207

12081208
## Time (`time`)
12091209

1210-
- `FORMAT`: Time format to display on UI. i.e. RFC1123 or 2006-01-02 15:04:05
12111210
- `DEFAULT_UI_LOCATION`: Default location of time on the UI, so that we can display correct user's time on UI. i.e. Asia/Shanghai
12121211

12131212
## Task (`task`)

modules/setting/time.go

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -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

1915
func 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

modules/timeutil/language.go

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)