Skip to content

Commit e855729

Browse files
authored
Merge pull request #40 from SeiferTim/main
trying to fix bugs
2 parents 8aab32f + d7a8ce2 commit e855729

File tree

3 files changed

+37
-132
lines changed

3 files changed

+37
-132
lines changed

.github/workflows/grab-events.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ jobs:
2121
node-version: '20'
2222

2323
- name: Install dependencies
24-
run: |
25-
npm install node-ical
26-
npm install luxon
27-
24+
run: npm install ical-expander luxon
2825

2926
- name: Download calendar
3027
run: curl -s "https://calendar.google.com/calendar/ical/c_dd5b9f0b9b6887c36cde8da86ef9282654e82998c89b4787cc8100fb65dc225e%40group.calendar.google.com/public/basic.ics" -o calendar.ics

data/events.json

Lines changed: 0 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +0,0 @@
1-
[
2-
{
3-
"title": "GameDev Social",
4-
"description": "",
5-
"location": "Dirty 20 Bar, 14051 Manchester Rd, Ballwin, MO 63011, USA",
6-
"dateTime": "2025-03-13T19:00:00.000-05:00",
7-
"eventUrl": ""
8-
},
9-
{
10-
"title": "STL Tech Week Games Panel",
11-
"description": "",
12-
"location": ".ZACK, 3224 Locust St, St. Louis, MO 63103, USA",
13-
"dateTime": "2025-04-01T11:00:00.000-05:00",
14-
"eventUrl": ""
15-
},
16-
{
17-
"title": "Dev Night Out @ Activate (Need to Confirm w Venue)",
18-
"description": "",
19-
"location": "Activate Games, 8324 Eager Rd, Brentwood, MO 63144, USA",
20-
"dateTime": "2025-04-05T18:00:00.000-05:00",
21-
"eventUrl": ""
22-
},
23-
{
24-
"title": "Anime STL",
25-
"description": "",
26-
"location": "St. Charles Convention Center, 1 Convention Center Blvd, St Charles, MO 63303, USA",
27-
"dateTime": "2025-04-24T19:00:00.000-05:00",
28-
"eventUrl": ""
29-
},
30-
{
31-
"title": "GameDev Social!",
32-
"description": "For full details, including the address, and to RSVP see: https://www.meetup.com/st-louis-game-developers/events/307069688\n\n",
33-
"location": "Dirty 20 Bar - 14051 Manchester Rd - Ballwin, MO, us",
34-
"dateTime": "2025-05-08T19:00:00.000-05:00",
35-
"eventUrl": ""
36-
},
37-
{
38-
"title": "MO Game Con",
39-
"description": "",
40-
"location": "Greensfelder Recreation Complex, 550 Weidman Rd, Manchester, MO 63011, USA",
41-
"dateTime": "2025-07-26T11:00:00.000-05:00",
42-
"eventUrl": ""
43-
},
44-
{
45-
"title": "Game Club (Hyper Light Drifter)",
46-
"description": "",
47-
"location": "QDOBA Mexican Eats, 766 N New Ballas Rd, Creve Coeur, MO 63141, USA",
48-
"dateTime": "2025-04-28T18:30:00.000-05:00",
49-
"eventUrl": ""
50-
},
51-
{
52-
"title": "Game Club",
53-
"description": "",
54-
"location": "QDOBA Mexican Eats, 766 N New Ballas Rd, Creve Coeur, MO 63141, USA",
55-
"dateTime": "2025-05-26T18:30:00.000-05:00",
56-
"eventUrl": ""
57-
},
58-
{
59-
"title": "SciFest: Play and Creativity Expo",
60-
"description": "\n  \nWelcome to SciFest: Play and Creativity Expo\n\n \n“Play is fundamentally important for learning 21st century skills, such as problem solving, collaboration, and creativity.” ~ American Academy of Pediatrics\n\n  \nSchedule Coming in 2025! \n  \n\n \n“The creation of something new is not accomplished by the intellect but by the play instinct.” ~ Carl Jung\n\n  \nShare your SciFest experiences with #SciFestSTL \n  \n\n \n“Play is not frivolous; it is brain building.”~ American Academy of Pediatrics\n\n  \n\nMark your calendar and join us for our 2025 SciFest events\n\nFebruary 22, 2025: Engineering Expo\nMay 10, 2025: The Great Outdoors Expo\nAugust 9, 2025: Play and Creativity Expo\nNovember 15, 2025: Sci-FEAST\n\n\n  \nSciFest: Connect with Science, Technology, Engineering and Math (STEM) professionals gathered exclusively for a series of day-long science and technology themed events.  Meet local scientists, engineers and other experts for a personal, close (View Full Event Description Here: https://www.slsc.org/event/scifest-play-and-creativity-expo/)",
61-
"location": "",
62-
"dateTime": "2025-08-09T09:30:00.000-05:00",
63-
"eventUrl": ""
64-
},
65-
{
66-
"title": "Game Club (Juice Galaxy)",
67-
"description": "",
68-
"location": "QDOBA Mexican Eats, 766 N New Ballas Rd, Creve Coeur, MO 63141, USA",
69-
"dateTime": "2025-03-31T19:00:00.000-05:00",
70-
"eventUrl": ""
71-
},
72-
{
73-
"title": "Share & Play",
74-
"description": "",
75-
"location": "St. Louis County Library–Grand Glaize Branch, 1010 Meramec Station Road, Manchester, MO 63021, USA",
76-
"dateTime": "2025-06-07T14:00:00.000-05:00",
77-
"eventUrl": ""
78-
},
79-
{
80-
"title": "SLPL Game Jam",
81-
"description": "Held in the Creative Experience Lab",
82-
"location": "St. Louis Public Library - Central Library, 1301 Olive St, St. Louis, MO 63103, USA",
83-
"dateTime": "2025-07-26T10:00:00.000-05:00",
84-
"eventUrl": ""
85-
},
86-
{
87-
"title": "SLPL Game Jam",
88-
"description": "Game Showcase\nHeld in the Creative Experience Lab",
89-
"location": "St. Louis Public Library - Central Library, 1301 Olive St, St. Louis, MO 63103, USA",
90-
"dateTime": "2025-07-27T14:00:00.000-05:00",
91-
"eventUrl": ""
92-
},
93-
{
94-
"title": "Spring Game Jam 25",
95-
"description": "<a href=\"https://www.meetup.com/st-louis-game-developers/events/307433670/\">https://www.meetup.com/st-louis-game-developers/events/307433670/</a>",
96-
"location": "https://itch.io/jam/stlgamedev-spring-jam",
97-
"dateTime": "2025-05-23T18:00:00.000-05:00",
98-
"eventUrl": ""
99-
},
100-
{
101-
"title": "Game Audio Club",
102-
"description": "",
103-
"location": "MAP St. Louis, 3840 Washington Ave, St. Louis, MO 63108, USA",
104-
"dateTime": "2025-04-26T16:00:00.000-05:00",
105-
"eventUrl": ""
106-
}
107-
]

scripts/convert-ics-to-json.js

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,42 @@
11
const fs = require('fs');
2-
const ical = require('node-ical');
32
const { DateTime } = require('luxon');
3+
const IcalExpander = require('ical-expander');
44

5-
(async () => {
6-
const data = await ical.parseFile('calendar.ics');
7-
const events = [];
5+
// Read the .ics file
6+
const icsData = fs.readFileSync('calendar.ics', 'utf8');
87

9-
for (const k in data) {
10-
const ev = data[k];
11-
if (ev.type === 'VEVENT') {
12-
// Assume the intended timezone is America/Chicago
13-
const dt = DateTime.fromJSDate(ev.start, { zone: 'utc' }).setZone('America/Chicago');
8+
// Parse it
9+
const icalExpander = new IcalExpander({ ics: icsData, maxIterations: 1000 });
1410

15-
events.push({
16-
title: ev.summary,
17-
description: ev.description || '',
18-
location: ev.location || '',
19-
// This is now correctly localized to Central Time
20-
dateTime: dt.toISO(), // e.g., 2025-05-23T17:00:00.000-05:00
21-
eventUrl: ev.url || ''
22-
});
23-
}
24-
}
11+
// Define time range for events to extract
12+
const now = new Date();
13+
const future = new Date(now.getFullYear() + 1, now.getMonth(), now.getDate());
2514

26-
fs.writeFileSync('data/events.json', JSON.stringify(events, null, 2));
27-
})();
15+
// Get expanded events (handles recurrence)
16+
const { events, occurrences } = icalExpander.between(now, future);
17+
18+
// Combine single and recurring events
19+
const allEvents = [
20+
...events.map(e => ({
21+
title: e.summary,
22+
description: e.description || '',
23+
location: e.location || '',
24+
dateTime: DateTime.fromJSDate(e.startDate.toJSDate(), { zone: e.startDate.zoneName }).toISO(),
25+
endTime: DateTime.fromJSDate(e.endDate.toJSDate(), { zone: e.endDate.zoneName }).toISO(),
26+
eventUrl: e.url || ''
27+
})),
28+
...occurrences.map(({ startDate, endDate, item }) => ({
29+
title: item.summary,
30+
description: item.description || '',
31+
location: item.location || '',
32+
dateTime: DateTime.fromJSDate(startDate.toJSDate(), { zone: startDate.zoneName }).toISO(),
33+
endTime: DateTime.fromJSDate(endDate.toJSDate(), { zone: endDate.zoneName }).toISO(),
34+
eventUrl: item.url || ''
35+
}))
36+
];
37+
38+
// Optional: sort by start time
39+
allEvents.sort((a, b) => new Date(a.dateTime) - new Date(b.dateTime));
40+
41+
// Write to events.json
42+
fs.writeFileSync('data/events.json', JSON.stringify(allEvents, null, 2));

0 commit comments

Comments
 (0)