Calendar events can also be all day - in such a case parse the 'date' field instead of 'dateTime'
This commit is contained in:
parent
e0ff431894
commit
ab02d7e79c
1 changed files with 5 additions and 1 deletions
|
@ -62,7 +62,11 @@ class CalendarPlugin(Plugin, CalendarInterface):
|
||||||
events.extend(calendar.get_upcoming_events().output)
|
events.extend(calendar.get_upcoming_events().output)
|
||||||
|
|
||||||
events = sorted(events, key=lambda event:
|
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)
|
return Response(output=events)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue