feat(binding): add global default time format

This commit is contained in:
Even Bøe 2024-02-17 19:26:09 +01:00
parent bb3519d26f
commit 843b01508c

View File

@ -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 {