From ba7c437a134160d1d2ae39067240a8c0f189e870 Mon Sep 17 00:00:00 2001 From: Max G Date: Thu, 21 Mar 2019 22:29:46 +0100 Subject: [PATCH] Recognizing multiday events in get_day_events --- Calendar/CalendarInterface.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Calendar/CalendarInterface.py b/Calendar/CalendarInterface.py index cd7a659..6676303 100644 --- a/Calendar/CalendarInterface.py +++ b/Calendar/CalendarInterface.py @@ -20,7 +20,9 @@ class CalendarInterface (DataSourceInterface): return self.get_day_events(datetime.now(timezone.utc)) def get_day_events(self, date): - return self.__get_events_to_filter__(lambda x : x.begin_datetime.strftime('%d-%m-%y') == date.strftime('%d-%m-%y')) + if type(date) is type(datetime.now()): + date = date.date() + return self.__get_events_to_filter__(lambda x : (x.begin_datetime.date() - date) <= timedelta(0) and (x.end_datetime.date() - date) >= timedelta(0)) def get_month_events(self, month = -1): if month < 0: