Check if two dates are on the same day

There are more ways to do this, but this is what I came up with:

{{ if and (eq .PublishDate.Year .Lastmod.Year) (eq .PublishDate.YearDay .Lastmod.YearDay) }}
{{ end }}

A little clunky, but it works.

8 Likes

In my theme I ended up using this:

{{ if ne (time.Format "2006-01-02" .Lastmod) (time.Format "2006-01-02" .Date) }}