1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 01:00:54 +00:00

fix bugs of ParseForm about time in RFC3339 format

This commit is contained in:
oberontang 2019-05-31 15:47:21 +08:00
parent 206a7ed1fc
commit 649c5c861d

View File

@ -361,6 +361,8 @@ func parseFormToStruct(form url.Values, objT reflect.Type, objV reflect.Value) e
if len(value) >= 25 { if len(value) >= 25 {
value = value[:25] value = value[:25]
t, err = time.ParseInLocation(time.RFC3339, value, time.Local) t, err = time.ParseInLocation(time.RFC3339, value, time.Local)
} else if strings.HasSuffix(strings.ToUpper(value), "Z") {
t, err = time.ParseInLocation(time.RFC3339, value, time.Local)
} else if len(value) >= 19 { } else if len(value) >= 19 {
if strings.Contains(value, "T") { if strings.Contains(value, "T") {
value = value[:19] value = value[:19]