diff --git a/cmd/init.go b/cmd/init.go index 99b7929e2..a9c355a7c 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -12,6 +12,7 @@ import ( "syscall" "time" + "github.com/Masterminds/sprig/v3" "github.com/jmoiron/sqlx" "github.com/jmoiron/sqlx/types" "github.com/knadh/goyesql/v2" @@ -602,6 +603,12 @@ func initNotifTemplates(path string, fs stuffbin.FileSystem, i *i18n.I18n, cs *c "LogoURL": func() string { return cs.LogoURL }, + "Date": func(layout string) string { + if layout == "" { + layout = time.ANSIC + } + return time.Now().Format(layout) + }, "L": func() *i18n.I18n { return i }, @@ -610,6 +617,10 @@ func initNotifTemplates(path string, fs stuffbin.FileSystem, i *i18n.I18n, cs *c }, } + for k, v := range sprig.GenericFuncMap() { + funcs[k] = v + } + tpls, err := stuffbin.ParseTemplatesGlob(funcs, fs, "/static/email-templates/*.html") if err != nil { lo.Fatalf("error parsing e-mail notif templates: %v", err)