From a119ef693faf5dc346fec78ca8a18948ec65a993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sat, 20 May 2017 11:41:43 +0300 Subject: [PATCH] tpl/time: Re-add the time example --- docs/data/docs.json | 6 ++---- tpl/time/init.go | 7 +++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/data/docs.json b/docs/data/docs.json index 852b110e7..698130c83 100644 --- 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" ] ] diff --git a/tpl/time/init.go b/tpl/time/init.go index 760986e5a..d0c774a0f 100644 --- a/tpl/time/init.go +++ b/tpl/time/init.go @@ -58,6 +58,13 @@ func init() { [][2]string{}, ) + ns.AddMethodMapping(ctx.AsTime, + nil, + [][2]string{ + {`{{ (time "2015-01-21").Year }}`, `2015`}, + }, + ) + return ns }