Parse strings as time if needed
This commit is contained in:
parent
1b0e9ce86f
commit
9979d911c7
1 changed files with 4 additions and 0 deletions
|
@ -132,6 +132,10 @@ func ensureTime(val interface{}) (out time.Time, ok bool) {
|
|||
switch val := val.(type) {
|
||||
case time.Time:
|
||||
return val, true
|
||||
case string:
|
||||
if val, err := time.Parse(time.RFC3339Nano, val); err == nil {
|
||||
return val, true
|
||||
}
|
||||
}
|
||||
return defaultTime, false
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue