Comparing 2 dates

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.

I’m not sure what you are trying to do here, but this looks wrong.

where operates on a collection, and I think you are missing an index before $r 0?

{{ $t := (time now).Format "2006-01-02" }}
{{ range $i, $r := getCSV $sep $url }}
{{ if gt $i 0 }} <!-- skip header row -->
  {{ $rtime := (time (index $r 0)).Format "2006-01-02" }}
  {{ $t }} / {{ $rtime }}
  {{ if eq $t $rtime }} <!-- check if eq -->
    Equal to today; do stuff.
  {{ end }}
{{ end }}