ref: a119ef693faf5dc346fec78ca8a18948ec65a993
parent: 1f9e8dcc6010abeea8abc7ba1a092c4dab9852f6
author: Bjørn Erik Pedersen <[email protected]>
date: Sat May 20 07:41:43 EDT 2017
tpl/time: Re-add the time example
--- a/docs/data/docs.json
+++ b/docs/data/docs.json
@@ -1439,12 +1439,10 @@
"Args": [
"v"
],
- "Aliases": [
- "asTime"
- ],
+ "Aliases": null,
"Examples": [
[
- "{{ (asTime \"2015-01-21\").Year }}",
+ "{{ (time \"2015-01-21\").Year }}",
"2015"
]
]
--- a/tpl/time/init.go
+++ b/tpl/time/init.go
@@ -58,6 +58,13 @@
[][2]string{},
)
+ ns.AddMethodMapping(ctx.AsTime,
+ nil,
+ [][2]string{
+ {`{{ (time "2015-01-21").Year }}`, `2015`},
+ },
+ )
+
return ns
}