I am trying to sort a json field from
which is in the format of month, year
- April, 2016
, when I do
{{ range sort . "from" "desc" }}
<tr>
<td>{{.from}} - {{.to}}</td>
<td>
{{.title}}
<p>{{if .company }}{{.company}},{{end}} {{.where}}</p>
</td>
</tr>
{{ end }}
It is sorted alphabetically.
{{ range sort . (dateFormat "January, 2006" "from") "desc" }}
doing something like this is giving me error.
How should I use dateFormat
in this case and then sort it?