Templates: add timeRound (#27408)

This commit is contained in:
andig 2026-02-14 15:02:51 +01:00 • committed by GitHub
parent fb6e238abb
commit 042ec1f1a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,6 +6,7 @@ import (
"net/url"
"strings"
"text/template"
"time"
"github.com/Masterminds/sprig/v3"
"go.yaml.in/yaml/v4"
@ -66,6 +67,9 @@ func FuncMap(tmpl *template.Template) *template.Template {
}
return buf.String(), nil
},
"timeRound": func(t time.Time, d time.Duration) time.Time {
return t.Round(d)
},
"urlEncode": url.QueryEscape,
"unquote": unquote,
"quote": yamlQuote,