Fixed bug

This commit is contained in:
Maximilian Giller 2019-04-23 07:30:08 +02:00
parent 29eddbbd18
commit d431dae196

View file

@ -1,5 +1,5 @@
from DataSourceInterface import DataSourceInterface from DataSourceInterface import DataSourceInterface
from datetime import datetime, timezone, timedelta from datetime import datetime, timezone, timedelta, date
from dateutil.rrule import rrulestr from dateutil.rrule import rrulestr
from dateutil.parser import parse from dateutil.parser import parse
import calendar import calendar
@ -30,10 +30,10 @@ class CalendarInterface (DataSourceInterface):
def get_today_events (self): def get_today_events (self):
return self.get_day_events(datetime.today()) return self.get_day_events(datetime.today())
def get_day_events (self, date): def get_day_events (self, day):
if type(date) is not type(date): if type(day) is not type(date.today()):
raise TypeError("get_day_events only takes date-objects as parameters, not \"%s\"" % str(type(date))) raise TypeError("get_day_events only takes date-objects as parameters, not \"%s\"" % str(type(day)))
day_start = datetime(date.year, date.month, date.day, 0, 0, 0, 0, timezone.utc) day_start = datetime(day.year, day.month, day.day, 0, 0, 0, 0, timezone.utc)
return self.__get_events_in_range__(day_start, timedelta(1)) return self.__get_events_in_range__(day_start, timedelta(1))
def get_month_events (self, month = -1): def get_month_events (self, month = -1):