diff options
author | Christian Franke <nobody@nowhere.ws> | 2016-12-16 23:22:00 +0100 |
---|---|---|
committer | Christian Franke <nobody@nowhere.ws> | 2016-12-16 23:22:00 +0100 |
commit | 08bd8f5de3a4694c84fbbd4bb1e5b22b323ecb28 (patch) | |
tree | 9f26fc3b3ab07df32c64a3e619fb86ba60e4fb98 | |
parent | 7310281bc49582d65f0d855214ca81be20debdc0 (diff) |
Fix get_calendar.py
-rw-r--r-- | scripts/get_calendar.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/get_calendar.py b/scripts/get_calendar.py index ee1674b..2fb12a7 100644 --- a/scripts/get_calendar.py +++ b/scripts/get_calendar.py @@ -1,5 +1,6 @@ from datetime import datetime, timedelta, time, date from dateutil.relativedelta import relativedelta +from dateutil import tz import urllib2 import json @@ -84,6 +85,10 @@ def get_events(calendar, after, before): end = datetime.combine(end, time()) if end.hour == 0 and end.minute == 0 and end.second == 0: end -= timedelta(seconds=1) + if start.tzinfo is not None: + start = start.astimezone(berlin).replace(tzinfo=None) + if end.tzinfo is not None: + end = end.astimezone(berlin).replace(tzinfo=None) if 'rrule' in event: rrule = rrulestr(event['rrule'].to_ical(), dtstart=start) |