How to display posts when date past

I would like to display only posts when date past and display others in others menu, but I can not.

<h2>Events :</h2>
{{  range  first 10 .Data.Pages }}
<!-- SI la page  est un post  -->
{{ if eq .Type "events" }}
<h2>
    <a href="{{.Permalink}}">{{.Date.Format "2006-01-02"}} | {{.Title}}</a>
</h2>

{{ end }}
<!-- Fin if -->
{{ end }}
<!-- Fin  range  -->


---

title: "Tester"

adress: ""

postalCode: "75000"

city: ""

label: ""

when: 2019-09-23T14:08:03+02:00

date: 2019-09-23T14:08:03+02:00

description: ""

photos: []

draf: false

important: true

association: ""

---

try to compare .Date with now
You can use AddDate function for calculations

{{ if lt .Date now }}

1 Like