{{ $context := .context }} {{ $year := .year }} {{ $day := .day }} {{ $dayTwoLetters := printf "%02d" $day }} {{ $pageMap := .pagemap }} {{ $month := .month }} {{ $monthTwoLetters := printf "%02d" $month }} {{ $dateString := (string (delimit (slice $year $monthTwoLetters $dayTwoLetters) "-")) }} {{ $dateTimeString := (printf "%sT23:59:59+02:00" $dateString) }} {{ $dateTimeStrStr := (printf "%sT00:00:00+02:00" $dateString) }} {{ $weekDay := ($dateString | time).Weekday | printf "%d" | int }} {{ $weekDayClass := slice "calendar-weekday-sun" "calendar-weekday-mon" "calendar-weekday-tue" "calendar-weekday-wed" "calendar-weekday-thu" "calendar-weekday-fri" "calendar-weekday-sat" "calendar-weekday-sun" }} {{ $context.Scratch.Set "isFuture" false }} {{ if le now (time $dateString) }} {{ $context.Scratch.Set "isFuture" true }} {{ end }} {{ $isFuture := $context.Scratch.Get "isFuture" }} {{ $pages := (where ($context.Scratch.Get "pages") "Date" "<=" ($dateTimeString | time)) }} {{ $pages := $pages | intersect (where ($context.Scratch.Get "pages") "Params.enddate" ">" ($dateTimeStrStr)) }} {{- $eventsFound := (cond (gt (len $pages) 0) true false) -}} {{ if (eq $weekDay 1) }}