Add offsetNow function
This commit is contained in:
1 parent
779304d035
commit
964744a9ae
2 files changed
+8
No files matched your search
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user