mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
tpl/time: Re-add the time example
This commit is contained in:
@@ -1439,12 +1439,10 @@
|
||||
"Args": [
|
||||
"v"
|
||||
],
|
||||
"Aliases": [
|
||||
"asTime"
|
||||
],
|
||||
"Aliases": null,
|
||||
"Examples": [
|
||||
[
|
||||
"{{ (asTime \"2015-01-21\").Year }}",
|
||||
"{{ (time \"2015-01-21\").Year }}",
|
||||
"2015"
|
||||
]
|
||||
]
|
||||
|
@@ -58,6 +58,13 @@ func init() {
|
||||
[][2]string{},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.AsTime,
|
||||
nil,
|
||||
[][2]string{
|
||||
{`{{ (time "2015-01-21").Year }}`, `2015`},
|
||||
},
|
||||
)
|
||||
|
||||
return ns
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user