From 0257d660503075a118e9182fc5b7143e73c837e2 Mon Sep 17 00:00:00 2001 From: Jan Koppe Date: Thu, 24 Dec 2020 12:59:12 +0000 Subject: [PATCH] apply "Fix incorrect timezone specification for some events (UTC instead of CET)" by octycs from upstream --- fahrplan.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fahrplan.py b/fahrplan.py index 1414def..127eca4 100644 --- a/fahrplan.py +++ b/fahrplan.py @@ -128,7 +128,14 @@ def events(scheduleUrl, titlemap={}): if __name__ == "__main__": - events = events(scheduleUrl) + events = list(events(scheduleUrl)) + + # FIX: Some events have an incorrectly specified timezone (UTC instead of CET) + for ev in events: + if ev['datetime'].endswith("+00:00"): + ev['datetime'] = ev['datetime'].replace("+00:00", "+01:00") + print(f"Warning: Assuming CET instead of UTC for event '{ev['title']}': {ev['datetime']}") + events = sorted(events, key=lambda x: datetime.datetime.fromisoformat(x["datetime"])) # Filter already passed events