updated date parsing
Update Calendar / update-calendar (push) Successful in 4s Details

This commit is contained in:
Drew 2026-02-11 19:47:04 -05:00
parent c30f25f4c7
commit efa691750c
3 changed files with 18 additions and 16 deletions

View File

@ -4,14 +4,12 @@
## Upcoming Events ## Upcoming Events
### LATE NITE LUG
- **Date:** February 26, 2026 at 08:15 PM EST
- **Location:** Online
- **Description:** Join us for the second Linux User Group of the Month
## Recent Past Events
### EARLY LUG ### EARLY LUG
- **Date:** February 12, 2026 at 12:15 PM EST - **Date:** February 12, 2026 at 12:15 PM ET
- **Location:** Online - **Location:** Online
- **Description:** Join us for the first Linux User Group of the Month - **Description:** Join us for the first Linux User Group of the Month
### LATE NITE LUG
- **Date:** February 26, 2026 at 08:15 PM ET
- **Location:** Online
- **Description:** Join us for the second Linux User Group of the Month

View File

@ -9,7 +9,7 @@ X-WR-CALDESC:Bi-monthly meetings for the Linux Cast User Group
BEGIN:VEVENT BEGIN:VEVENT
UID:a2b0842c2b5a01104c433fc893c295bb@thelinuxcast.org UID:a2b0842c2b5a01104c433fc893c295bb@thelinuxcast.org
DTSTAMP:20260212T000016Z DTSTAMP:20260212T004451Z
DTSTART:20260212T171500Z DTSTART:20260212T171500Z
DTEND:20260212T181500Z DTEND:20260212T181500Z
SUMMARY:Linux Cast User Group: EARLY LUG SUMMARY:Linux Cast User Group: EARLY LUG
@ -20,7 +20,7 @@ END:VEVENT
BEGIN:VEVENT BEGIN:VEVENT
UID:d2f7d7de1a333caed5783ceb4168f501@thelinuxcast.org UID:d2f7d7de1a333caed5783ceb4168f501@thelinuxcast.org
DTSTAMP:20260212T000016Z DTSTAMP:20260212T004451Z
DTSTART:20260227T011500Z DTSTART:20260227T011500Z
DTEND:20260227T021500Z DTEND:20260227T021500Z
SUMMARY:Linux Cast User Group: LATE NITE LUG SUMMARY:Linux Cast User Group: LATE NITE LUG

View File

@ -18,13 +18,14 @@ def load_meetings(yaml_file='meetings.yaml'):
def filter_meetings(meetings, months=3): def filter_meetings(meetings, months=3):
"""Filter meetings to show only those within the last/next N months""" """Filter meetings to show only those within the last/next N months"""
now = datetime.now() now = datetime.now(ZoneInfo('America/Detroit'))
cutoff_past = now - timedelta(days=30 * months) cutoff_past = now - timedelta(days=30 * months)
cutoff_future = now + timedelta(days=30 * months) cutoff_future = now + timedelta(days=30 * months)
filtered = [] filtered = []
for meeting in meetings: for meeting in meetings:
meeting_date = datetime.strptime(meeting['date'], '%Y-%m-%d') tz = ZoneInfo(meeting.get('timezone', 'America/Detroit'))
meeting_date = datetime.strptime(meeting['date'], '%Y-%m-%d').replace(tzinfo=tz)
if cutoff_past <= meeting_date <= cutoff_future: if cutoff_past <= meeting_date <= cutoff_future:
filtered.append(meeting) filtered.append(meeting)
@ -92,14 +93,17 @@ def generate_ics(meetings, output_file='calendar.ics'):
def generate_readme(meetings, output_file='README.md'): def generate_readme(meetings, output_file='README.md'):
"""Generate README.md from meetings""" """Generate README.md from meetings"""
now = datetime.now() now = datetime.now(ZoneInfo('America/Detroit'))
# Separate past and upcoming meetings # Separate past and upcoming meetings
past_meetings = [] past_meetings = []
upcoming_meetings = [] upcoming_meetings = []
for meeting in meetings: for meeting in meetings:
meeting_date = datetime.strptime(meeting['date'], '%Y-%m-%d') tz = ZoneInfo(meeting.get('timezone', 'America/Detroit'))
meeting_date = datetime.strptime(
f"{meeting['date']} {meeting['time']}", '%Y-%m-%d %H:%M'
).replace(tzinfo=tz)
if meeting_date < now: if meeting_date < now:
past_meetings.append(meeting) past_meetings.append(meeting)
else: else:
@ -127,7 +131,7 @@ def generate_readme(meetings, output_file='README.md'):
lines.extend([ lines.extend([
f"### {meeting['title']}", f"### {meeting['title']}",
f"- **Date:** {formatted_date} EST", f"- **Date:** {formatted_date} ET",
f"- **Location:** {meeting.get('location', 'Online')}", f"- **Location:** {meeting.get('location', 'Online')}",
f"- **Description:** {meeting['description']}", f"- **Description:** {meeting['description']}",
'' ''
@ -144,7 +148,7 @@ def generate_readme(meetings, output_file='README.md'):
lines.extend([ lines.extend([
f"### {meeting['title']}", f"### {meeting['title']}",
f"- **Date:** {formatted_date} EST", f"- **Date:** {formatted_date} ET",
f"- **Location:** {meeting.get('location', 'Online')}", f"- **Location:** {meeting.get('location', 'Online')}",
f"- **Description:** {meeting['description']}", f"- **Description:** {meeting['description']}",
'' ''