@@ -1,6 +1,7 @@
1import Head from "next/head";
1import Head from "next/head";
2import Link from "next/link";
2import Link from "next/link";
3import React, { useState, useEffect } from "react";
3import React, { useState, useEffect } from "react";
4+import { DateTime } from "luxon";
5import Container from "../components/Container";
6import Container from "../components/Container";
6import Section from "../components/Section";
7import Section from "../components/Section";
@@ -18,6 +19,7 @@ import {
18 getAllEvents,
19 getAllEvents,
19 formatDate,
20 formatDate,
20 getOpenGrantsCount,
21 getOpenGrantsCount,
22+ generateRealtimeDate,
21} from "../lib/lib";
23} from "../lib/lib";
22import { contact, eventKeys } from "../lib/constants";
24import { contact, eventKeys } from "../lib/constants";
23import { useLocalStorage } from "../lib/hooks";
25import { useLocalStorage } from "../lib/hooks";
@@ -299,7 +301,23 @@ export async function getStaticProps() {
304+ const now = DateTime.now();
302− const events = getAllEvents(eventKeys, "events");
306+ const events = getAllEvents(eventKeys, "events")
307+ .filter((event) => {
308+ const starts = generateRealtimeDate(event.starts);
309+ return starts > now;
312+ const aStarts = generateRealtimeDate(a.starts).ts;
313+ const bStarts = generateRealtimeDate(b.starts).ts;
314+ if (aStarts > bStarts) {
316+ } else if (aStarts === bStarts) {
305 props: { posts, events, openGrantsCount },
323 props: { posts, events, openGrantsCount },