fix(talks): only count past talks

This commit is contained in:
Oliver Davies 2023-08-03 00:01:31 +01:00
parent d043c28fda
commit e9e0ae5b19

View file

@ -1,17 +1,18 @@
--- ---
import ListingPage from "~/components/ListingPage.astro"; import ListingPage from "~/components/ListingPage.astro";
import Markdown from "~/components/Markdown.astro";
import _ from "lodash"; import _ from "lodash";
import { getCollection } from "astro:content"; import { getCollection } from "astro:content";
import Markdown from "~/components/Markdown.astro";
const talks = await getCollection("talk"); const talks = await getCollection("talk");
const today = new Date().valueOf();
const talkCount = _(talks) const talkCount = _(talks)
.flatMap((talk) => talk.data.events) .flatMap((talk) => talk.data.events)
.filter((event): boolean => new Date(event.date).valueOf() <= today)
.size(); .size();
const today = new Date().valueOf();
const sortedTalks = talks const sortedTalks = talks
.map((talk) => { .map((talk) => {
const slug = `/talks/${talk.slug}`; const slug = `/talks/${talk.slug}`;