mevkk
1
Hi,
i have created a field in frontmatter,
lastdate: 2019-04-13T04:47:50.384Z
and i am accessing and formatting it like
<div class="col s4 m4 l4 red-text">
Last Date : {{ dateFormat "Monday, Jan 2, 2006" ".Params.lastdate"}}
</div>
But i am getting following error.
Any help?
Thanks.
Try it without the ""
around .Params.lastdate
:
{{ dateFormat "Monday, Jan 2, 2006" .Params.lastdate }}
Also, to be safe, just in case you have content that does not have that frontmatter value, I would wrap it in a with
block to test first:
{{ with .Params.lastdate }}
{{ dateFormat "Monday, Jan 2, 2006" . }}
{{ end }}
2 Likes