Skip to content

Commit 58f0628

Browse files
committed
timezones are hard
1 parent 75ee14b commit 58f0628

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

dojo_plugin/api/v1/discord.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,6 @@ class CourseMemes(Resource):
139139
@authed_only
140140
@dojo_route
141141
def get(self, dojo):
142-
143-
from datetime import timedelta, timezone
144-
145142
def bucket_from_start_then_sundays(ts, course_start):
146143
start = course_start.astimezone(timezone.utc)
147144

@@ -163,7 +160,7 @@ def bucket_from_start_then_sundays(ts, course_start):
163160
course_start = dojo.course.get("start_date", None)
164161
if course_start is None:
165162
return {"success": False, "error": "No course start"}
166-
course_start = datetime.fromisoformat(course_start)
163+
course_start = datetime.fromisoformat(course_start).astimezone(timezone.utc)
167164

168165
memes = (
169166
discord_user.memes(start=course_start, end=course_start + timedelta(weeks=17))

0 commit comments

Comments
 (0)