Skip to content

Commit

Permalink
fix bugs of ParseForm about time in RFC3339 format
Browse files Browse the repository at this point in the history
  • Loading branch information
oberontang committed May 31, 2019
1 parent 206a7ed commit 649c5c8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions templatefunc.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,8 @@ func parseFormToStruct(form url.Values, objT reflect.Type, objV reflect.Value) e
if len(value) >= 25 {
value = value[:25]
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 {
if strings.Contains(value, "T") {
value = value[:19]
Expand Down

0 comments on commit 649c5c8

Please sign in to comment.