tpl/time: Use configured location when date passed to Format is string

Updates #9084
This commit is contained in:
Bjørn Erik Pedersen
2021-10-30 16:06:00 +02:00
parent 3339c2bb61
commit e82cbd746f
2 changed files with 55 additions and 34 deletions

View File

@@ -63,7 +63,7 @@ func (ns *Namespace) AsTime(v interface{}, args ...interface{}) (interface{}, er
// the other form or returns it of the time.Time value. These are formatted
// with the layout string
func (ns *Namespace) Format(layout string, v interface{}) (string, error) {
t, err := cast.ToTimeE(v)
t, err := htime.ToTimeInDefaultLocationE(v, ns.location)
if err != nil {
return "", err
}