From 08bd8f5de3a4694c84fbbd4bb1e5b22b323ecb28 Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Fri, 16 Dec 2016 23:22:00 +0100 Subject: Fix get_calendar.py --- scripts/get_calendar.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'scripts') 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) -- cgit v1.2.1