Templates: add timeRound (#27408)
This commit is contained in:
parent
fb6e238abb
commit
042ec1f1a7
1 changed files with 4 additions and 0 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue