Skip to content

Commit 71337cb

Browse files
Slashgearclaude
andcommitted
feat: filter homepage sponsors to last 12 months
Only display sponsors who sponsored an event in the last 12 months instead of showing all sponsors ever. Uses schedule data as source of truth. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 25e13c1 commit 71337cb

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

app/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as sponsors from '../data/sponsors';
1+
import { getRecentSponsors } from '../data/schedule';
22
import * as partners from '../data/partners';
33
import React from 'react';
44
import { HomeHero } from '../modules/home/HomeHero';
@@ -12,6 +12,7 @@ import { HomeAnnouncement } from '../modules/lyonjs100/HomeAnnouncement';
1212
export const revalidate = 3600;
1313

1414
export default function Home() {
15+
const sponsors = getRecentSponsors();
1516
return (
1617
<main>
1718
<HomeHero />

data/schedule.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,19 @@ export const schedule: Schedule[] = [
109109
date: '06/10/2026',
110110
},
111111
];
112+
113+
export function getRecentSponsors(months = 12): Record<string, Sponsor> {
114+
const now = new Date();
115+
const cutoff = new Date(now.getFullYear(), now.getMonth() - months, now.getDate());
116+
117+
const result: Record<string, Sponsor> = {};
118+
for (const entry of schedule) {
119+
if (!entry.sponsor?.logo) continue;
120+
const [month, day, year] = entry.date.split('/');
121+
const date = new Date(Number(year), Number(month) - 1, Number(day));
122+
if (date >= cutoff && date <= now) {
123+
result[entry.sponsor.name] = entry.sponsor;
124+
}
125+
}
126+
return result;
127+
}

0 commit comments

Comments
 (0)