mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Allow incompletely specified Time Formats (#8816)
* Allow incompletely specified time formats * Adjust error reporting slightly * Update setting.go
This commit is contained in:
		@@ -835,7 +835,8 @@ func NewContext() {
 | 
				
			|||||||
			TimeFormat = timeFormatKey
 | 
								TimeFormat = timeFormatKey
 | 
				
			||||||
			TestTimeFormat, _ := time.Parse(TimeFormat, TimeFormat)
 | 
								TestTimeFormat, _ := time.Parse(TimeFormat, TimeFormat)
 | 
				
			||||||
			if TestTimeFormat.Format(time.RFC3339) != "2006-01-02T15:04:05Z" {
 | 
								if TestTimeFormat.Format(time.RFC3339) != "2006-01-02T15:04:05Z" {
 | 
				
			||||||
				log.Fatal("Can't create time properly, please check your time format has 2006, 01, 02, 15, 04 and 05")
 | 
									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)
 | 
								log.Trace("Custom TimeFormat: %s", TimeFormat)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user