import { Navbar } from "@/components/public/Navbar"; import { Footer } from "@/components/public/Footer"; import { MeetupCard } from "@/components/public/MeetupCard"; import { AddToCalendarButton } from "@/components/public/AddToCalendarDialog"; import { getMeetupStartUtc } from "@/lib/meetupEventTime"; import { apiUrl } from "@/lib/api-base"; // Re-render at most every 5 minutes so the upcoming/past split stays current. export const revalidate = 300; async function fetchMeetups(): Promise { try { const res = await fetch(apiUrl("/meetups"), { next: { revalidate: 300 } }); if (!res.ok) return []; const data = await res.json(); return Array.isArray(data) ? data : []; } catch { return []; } } export default async function EventsPage() { const meetups = await fetchMeetups(); const now = new Date(); const upcoming = meetups.filter((m) => { const start = getMeetupStartUtc(m.date, m.time || "00:00"); if (Number.isNaN(start.getTime())) return false; return start >= now; }); const past = meetups .filter((m) => { const start = getMeetupStartUtc(m.date, m.time || "00:00"); if (Number.isNaN(start.getTime())) return false; return start < now; }) .reverse(); return ( <>

Belgian Bitcoin Embassy

All Events

Past and upcoming Bitcoin meetups in Belgium.

Upcoming {upcoming.length > 0 && ( {upcoming.length} )}

{upcoming.length === 0 ? (

No upcoming events scheduled. Check back soon.

) : (
{upcoming.map((m) => ( ))}
)}
{past.length > 0 && (

Past Events

{past.map((m) => ( ))}
)}