Add offsetNow function

This commit is contained in:
Svilen Markov
2025-03-29 17:57:43 +00:00
parent 779304d035
commit 964744a9ae
2 changed files with 8 additions and 0 deletions

View File

@@ -435,6 +435,13 @@ var customAPITemplateFuncs = func() template.FuncMap {
"now": func() time.Time {
return time.Now()
},
"offsetNow": func(offset string) time.Time {
d, err := time.ParseDuration(offset)
if err != nil {
return time.Now()
}
return time.Now().Add(d)
},
"duration": func(str string) time.Duration {
d, err := time.ParseDuration(str)
if err != nil {