Fix timezone support for mysql

This commit is contained in:
Roman Vynar 2024-02-21 13:37:11 +02:00
parent 37bcc85cab
commit 8a48bd4e8b

View File

@ -53,7 +53,11 @@ func setupRenderer(debug bool, registryHost, basePath string) *Template {
return registry.PrettySize(value)
})
view.AddGlobal("pretty_time", func(timeVal interface{}) string {
t, _ := time.Parse("2006-01-02T15:04:05Z", timeVal.(string))
t, err := time.Parse("2006-01-02T15:04:05Z", timeVal.(string))
if err != nil {
// mysql case
t, _ = time.Parse("2006-01-02 15:04:05", timeVal.(string))
}
return t.In(time.Local).Format("2006-01-02 15:04:05 MST")
})
view.AddGlobal("parse_map", func(m interface{}) string {