summaryrefslogtreecommitdiffstats
path: root/tpl/time/init.go
diff options
context:
space:
mode:
Diffstat (limited to 'tpl/time/init.go')
-rw-r--r--tpl/time/init.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/tpl/time/init.go b/tpl/time/init.go
index db8294a6e..3112999e4 100644
--- a/tpl/time/init.go
+++ b/tpl/time/init.go
@@ -65,6 +65,20 @@ func init() {
},
)
+ ns.AddMethodMapping(ctx.Duration,
+ []string{"duration"},
+ [][2]string{
+ {`{{ mul 60 60 | duration "second" }}`, `1h0m0s`},
+ },
+ )
+
+ ns.AddMethodMapping(ctx.ParseDuration,
+ nil,
+ [][2]string{
+ {`{{ "1h12m10s" | time.ParseDuration }}`, `1h12m10s`},
+ },
+ )
+
return ns
}