Can't evaluate field isZero in type time.Time

Hi, I was wondering what would be the updated answer for this?

   {{ if not .Date.IsZero }}

is giving me

   <.Date.isZero>: can't evaluate field isZero in type time.Time

I am unable to reproduce this error with v0.88.1.

content/post/test.md

+++
title = 'Test'
date = 2021-10-04T10:44:41-07:00
draft = false
+++

layouts/_default/single.html

{{ if not .Date.IsZero }} NOT ZERO {{ end }}

I just looked at your error message again. The code that you posted is not the same as the code in your template.

Your are using .isZero instead of .IsZero.

3 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.