fix date sorting
Some checks failed
website-main / prod-build (push) Failing after 14s
website-main / test-build (push) Failing after 6s

This commit is contained in:
Denys Konovalov 2024-03-24 16:11:29 +01:00
parent 1287ea1d51
commit 942ef76fc9
Signed by: Denys Konovalov
GPG Key ID: 0037E1B0E33BD2C9
5 changed files with 7 additions and 7 deletions

@ -224,8 +224,8 @@
{{ with .Site.GetPage "/termine/_index.md" }}
{{ $events := slice }}
{{ range .Params.events }}
{{ if or (ge (.date | time.AsTime).Unix now.Unix) (and .enddate (ge (.enddate | time.AsTime).Unix now.Unix)) }}
{{ range sort .Params.events ".date" }}
{{ if partial "data/termin-upcoming" . }}
{{ $events = $events | append . }}
{{ end }}
{{ end }}

@ -0,0 +1 @@
{{ return or (ge (.date | time.AsTime) now) (and .enddate (ge (.enddate | time.AsTime) now)) }}

@ -86,7 +86,7 @@
{{ $top_banner := .Site.Data.homepage.top_banner }}
{{ if and $top_banner.enable }}
{{ if or (not $top_banner.temporarily.enable) (and $top_banner.temporarily.enable (and (le ($top_banner.temporarily.start_date | time.AsTime).Unix now.Unix ) (ge ($top_banner.temporarily.end_date | time.AsTime).Unix now.Unix))) }}
{{ if or (not $top_banner.temporarily.enable) (and $top_banner.temporarily.enable (and (le ($top_banner.temporarily.start_date | time.AsTime) now) (ge ($top_banner.temporarily.end_date | time.AsTime) now))) }}
{{ with $top_banner }}
<div id="top-banner" class="p-3" style="background: {{ .color }}" data-pagefind-ignore>
<div class="container">

@ -1,2 +1 @@
{{ $related := (where .Site.RegularPages "Type" .Type) | intersect (where .Site.Pages ".Title" "!=" .Title) | union (.Site.RegularPages.Related . ) | shuffle | first 3 }}
{{ return $related }}
{{ return (where .Site.RegularPages "Type" .Type) | intersect (where .Site.Pages ".Title" "!=" .Title) | union (.Site.RegularPages.Related . ) | shuffle | first 3 }}

@ -8,8 +8,8 @@
<li class="list-inline-item m-3 text-uppercase" data-filter="past">Vergangen</li>
</ul>
<div class="filter-container row mx-auto">
{{ range .Params.events }}
<div class="filter-item col-12" data-groups="{{ if or (ge (.date | time.AsTime).Unix now.Unix) (and .enddate (ge (.enddate | time.AsTime).Unix now.Unix)) }}upcoming{{else}}past{{end}}" data-time="{{.date}}">
{{ range sort .Params.events ".date" }}
<div class="filter-item col-12" data-groups='{{if partial "data/termin-upcoming" .}}upcoming{{else}}past{{end}}'>
{{ partial "termin" . }}
</div>
{{ end }}