From 83d4385f1f94acde7972801abec35b6508db8cb6 Mon Sep 17 00:00:00 2001 From: Guohua Ouyang Date: Sat, 25 Mar 2017 07:52:43 +0800 Subject: [PATCH] Support time.RFC3339 Signed-off-by: Guohua Ouyang --- templatefunc.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/templatefunc.go b/templatefunc.go index 8ecacbfe..5bd7b73f 100644 --- a/templatefunc.go +++ b/templatefunc.go @@ -362,7 +362,10 @@ func parseFormToStruct(form url.Values, objT reflect.Type, objV reflect.Value) e t time.Time err error ) - if len(value) >= 19 { + if len(value) >= 25 { + value = value[:25] + t, err = time.ParseInLocation(time.RFC3339, value, time.Local) + } else if len(value) >= 19 { value = value[:19] t, err = time.ParseInLocation(formatDateTime, value, time.Local) } else if len(value) >= 10 {