"recent" and "current"?

related to my other question: How to represent an 'ongoing' date?

i have a list of data files with dates in them. how can i display a list of recently transpired events, and a list of currently ongoing events?

repo is here: https://gitlab.com/fustkilas/oovoo

still looking for an answer…

What have you tried so far?

for “current” i tried:

{{ range where .Site.Data.shows ".finissage" "ge" (now.AddDate 0 0 0) }}

and also

{{ range where .Site.Data.shows ".finissage" "ge" now }}

i got this snippet from https://gohugo.io/functions/adddate/

also, my data files look like this: https://gitlab.com/fustkilas/oovoo/tree/master/data/shows

an example “current” show would be: https://gitlab.com/fustkilas/oovoo/blob/master/data/shows/school-of-pain.yml

any ideas? i figure i’m messing up the range function somehow

If you want to get the current year, do:

now.Format "2006"

See .Format docs for more examples, if you wanted to current month and day too

but that shouldnt matter, i’m trying to extract all data files whose “.finissage” is greater than the current date… how would i do that? see my last snippet for what i tried

You could range the data file normally, then do your date comparison within:

{{ range .Site.Data.shows }}
  {{ $now := now.Format "2006-01-02" }}
  {{ if (ge .finissage $now) }}

this works for everything EXCEPT


any idea why?

ne , le

do work with .vernissage for example

i do have data files which have finissage dates after today, so dunno why this is happening?

Function Thing it does
ge greater than or equal to
gt greater than

yeah i do understand the difference between ge and gt
neither work with my data, i wonder why

See my previous example. I updated it. You want to get now as YYYY-MM-DD

yes indeed! that was it! thanks so much @zwbetz!

i think this will also solve my “recent” conundrum, let me work on it

again @zwbetz thank you very much for spending so much time on my concerns! i’m grateful to you