From adca4558044e9eb5bc64492021f2128773930826 Mon Sep 17 00:00:00 2001 From: onealtang Date: Wed, 2 Sep 2015 15:50:40 +0800 Subject: [PATCH] always use server's locale to parse date When parsing the date without time, it's always using UTC date, which is unexpected. If we want to use UTC date, it's recommend to set the server's timezone as UTC, and keep the code flexible. --- templatefunc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templatefunc.go b/templatefunc.go index 28ed15a3..39ada253 100644 --- a/templatefunc.go +++ b/templatefunc.go @@ -352,7 +352,7 @@ func ParseForm(form url.Values, obj interface{}) error { if len(tags) > 1 { format = tags[1] } - t, err := time.Parse(format, value) + t, err := time.ParseInLocation(format, value, time.Local) if err != nil { return err }