Skip to content

Commit b06b9e6

Browse files
committed
Fix calendar generation
1 parent 05b51f3 commit b06b9e6

2 files changed

Lines changed: 28 additions & 3 deletions

File tree

bin/build-calendar-ics.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,20 @@
44
from __future__ import annotations
55

66
from dataclasses import dataclass
7-
from datetime import UTC, datetime
7+
from datetime import datetime, timezone
8+
import os
89
from pathlib import Path
10+
import shutil
11+
import sys
912
from zoneinfo import ZoneInfo
10-
import tomllib
13+
14+
try:
15+
import tomllib
16+
except ModuleNotFoundError:
17+
py312 = shutil.which("python3.12")
18+
if py312 and sys.executable != py312:
19+
os.execvp(py312, [py312, __file__, *sys.argv[1:]])
20+
raise RuntimeError("build-calendar-ics.py requires Python 3.11+ or an available python3.12")
1121

1222

1323
ROOT = Path(__file__).resolve().parent.parent
@@ -68,7 +78,7 @@ def parse_front_matter(page_path: Path) -> dict:
6878

6979
def parse_utc(timestamp: str) -> datetime:
7080
# Content stores UTC timestamps with trailing Z.
71-
return datetime.fromisoformat(timestamp.replace("Z", "+00:00")).astimezone(UTC)
81+
return datetime.fromisoformat(timestamp.replace("Z", "+00:00")).astimezone(timezone.utc)
7282

7383

7484
def ical_escape(value: str) -> str:

static/calendar.ics

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,4 +217,19 @@ DESCRIPTION:BitDevs is a place for open discussion of the technical aspec
217217
ard to gain admission\, but you do not need to RSVP in public.
218218
URL:https://trianglebitdevs.org/socratic-seminar-50/
219219
END:VEVENT
220+
BEGIN:VEVENT
221+
UID:socratic-seminar-51-20260408t220000z@trianglebitdevs.org
222+
DTSTAMP:20260408T220000Z
223+
DTSTART;TZID=America/New_York:20260408T180000
224+
DTEND;TZID=America/New_York:20260408T200000
225+
SUMMARY:Socratic Seminar 51
226+
LOCATION:Fidelity Investments - Corporate Office\, Durham\, North Carolin
227+
a
228+
DESCRIPTION:BitDevs is a place for open discussion of the technical aspec
229+
ts of bitcoin and related protocols. Be advised: discussion will be tech
230+
nical. Please RSVP or email trianglebitdevs at protonmail dot com to con
231+
firm your attendance. You will be required to show ID to the security gu
232+
ard to gain admission\, but you do not need to RSVP in public.
233+
URL:https://trianglebitdevs.org/socratic-seminar-51/
234+
END:VEVENT
220235
END:VCALENDAR

0 commit comments

Comments
 (0)