I have a .csv file used to populate a table. The first column is a date string in the following format “13/3/2020”. I would like to compare it to todays date, in the same format.
I’m having a hard time getting this to work. Here’s what I’ve tried:
{{ define "main" }}
<div class="container mx-auto markdown">
<h1 class="text-4xl font-bold mt-4 mb-1 leading-none">{{ .Title }}</h1>
{{ $url := "http://cowid.netlify.com/data/full_data.csv" }}
{{ $sep := "," }}
{{ $t := (time now) }}
{{ range $i, $r := getCSV $sep $url }}
{{ where $t.Equal (time ($r 0)) }}
<p>{{ index $r 1 }}</p>
{{ end }}
{{ .Content }}
</div>
{{ end }}
The error I get is:
execute of template failed: template: _default\statistics.html:10:12: executing "main" at <$t.Equal>: wrong number of args for Equal: want 1 got 0
Any idea’s how to get this working. Go is very alien to me.