Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix todoist calendar events #39197

Merged
merged 1 commit into from Aug 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions homeassistant/components/todoist/calendar.py
Expand Up @@ -503,12 +503,19 @@ async def async_get_events(self, hass, start_date, end_date):
continue
due_date = _parse_due_date(task["due"])
if start_date < due_date < end_date:
if due_date.hour == 0 and due_date.minute == 0:
# If the due date has no time data, return just the date so that it
# will render correctly as an all day event on a calendar.
due_date_value = due_date.strftime("%Y-%m-%d")
else:
due_date_value = due_date.isoformat()
event = {
"uid": task["id"],
"title": task["content"],
"start": due_date.isoformat(),
"end": due_date.isoformat(),
"start": due_date_value,
"end": due_date_value,
"allDay": True,
"summary": task["content"],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds the title of the event to the calendar.

}
events.append(event)
return events
Expand Down