From ab02d7e79c8094791162101f22ce240d8a175ded Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Wed, 13 Jun 2018 00:54:59 +0200 Subject: [PATCH] Calendar events can also be all day - in such a case parse the 'date' field instead of 'dateTime' --- platypush/plugins/calendar/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/platypush/plugins/calendar/__init__.py b/platypush/plugins/calendar/__init__.py index 5f0c9369..b82ea335 100644 --- a/platypush/plugins/calendar/__init__.py +++ b/platypush/plugins/calendar/__init__.py @@ -62,7 +62,11 @@ class CalendarPlugin(Plugin, CalendarInterface): events.extend(calendar.get_upcoming_events().output) events = sorted(events, key=lambda event: - dateutil.parser.parse(event['start']['dateTime']))[:max_results] + dateutil.parser.parse( + event['start']['dateTime'] + if 'dateTime' in event['start'] + else event['start']['date'] + 'T00:00:00+00:00' + ))[:max_results] return Response(output=events)