Skip to content

Commit 06e405b

Browse files
authored
Fix issue with events no longer showing on homepage (boostorg#1990) (boostorg#1991)
1 parent a5ba797 commit 06e405b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/calendar.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import datetime
1+
from datetime import datetime, timezone
22
from django.conf import settings
33
import requests
44
from collections import defaultdict
@@ -21,7 +21,9 @@ def get_calendar(min_time=None, single_events=True, order_by="startTime"):
2121
"""
2222
if not min_time:
2323
# 'Z' indicates UTC time
24-
min_time = datetime.datetime.now(datetime.timezone.utc).isoformat() + "Z"
24+
# we replace +00:00 with Z because google no longer seems to be fully rfc3339
25+
# compliant for this parameter, even with a valid format ending with +00:00
26+
min_time = datetime.now(timezone.utc).isoformat().replace("+00:00", "Z")
2527
url = f"https://www.googleapis.com/calendar/v3/calendars/{settings.BOOST_CALENDAR}/events?key={settings.CALENDAR_API_KEY}&timeMin={min_time}&singleEvents={single_events}&orderBy={order_by}"
2628

2729
headers = {"Accept": "application/json"}

0 commit comments

Comments
 (0)