mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-15 21:06:39 +08:00
feat(binding): add global default time format
This commit is contained in:
parent
bb3519d26f
commit
843b01508c
@ -297,10 +297,12 @@ func setFloatField(val string, bitSize int, field reflect.Value) error {
|
||||
return err
|
||||
}
|
||||
|
||||
var DefaultTimeFormat = time.RFC3339
|
||||
|
||||
func setTimeField(val string, structField reflect.StructField, value reflect.Value) error {
|
||||
timeFormat := structField.Tag.Get("time_format")
|
||||
if timeFormat == "" {
|
||||
timeFormat = time.RFC3339
|
||||
timeFormat = DefaultTimeFormat
|
||||
}
|
||||
|
||||
switch tf := strings.ToLower(timeFormat); tf {
|
||||
|
Loading…
x
Reference in New Issue
Block a user