From e9e0ae5b19913d9cb86f24a30d0386dd8ea1c822 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 3 Aug 2023 00:01:31 +0100 Subject: [PATCH] fix(talks): only count past talks --- src/pages/talks/index.astro | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pages/talks/index.astro b/src/pages/talks/index.astro index 197b76e4..fec76057 100644 --- a/src/pages/talks/index.astro +++ b/src/pages/talks/index.astro @@ -1,17 +1,18 @@ --- import ListingPage from "~/components/ListingPage.astro"; +import Markdown from "~/components/Markdown.astro"; import _ from "lodash"; import { getCollection } from "astro:content"; -import Markdown from "~/components/Markdown.astro"; const talks = await getCollection("talk"); +const today = new Date().valueOf(); + const talkCount = _(talks) .flatMap((talk) => talk.data.events) + .filter((event): boolean => new Date(event.date).valueOf() <= today) .size(); -const today = new Date().valueOf(); - const sortedTalks = talks .map((talk) => { const slug = `/talks/${talk.slug}`;