Add day to event end to correct TwenteMilieu event timespan (#89028)

[TwenteMilieu] Add day to event end to correct event timespan

Co-authored-by: Allen Porter <allen@thebends.org>
This commit is contained in:
Bob van de Vijver 2023-03-04 05:06:28 +01:00 committed by GitHub
parent 1bd9767d8c
commit b27b094e27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -1,7 +1,7 @@
"""Support for Twente Milieu Calendar."""
from __future__ import annotations
from datetime import date, datetime
from datetime import date, datetime, timedelta
from twentemilieu import WasteType
@ -58,7 +58,7 @@ class TwenteMilieuCalendar(TwenteMilieuEntity, CalendarEntity):
CalendarEvent(
summary=WASTE_TYPE_TO_DESCRIPTION[waste_type],
start=waste_date,
end=waste_date,
end=waste_date + timedelta(days=1),
)
for waste_date in waste_dates
if start_date.date() <= waste_date <= end_date.date()
@ -89,7 +89,7 @@ class TwenteMilieuCalendar(TwenteMilieuEntity, CalendarEntity):
self._event = CalendarEvent(
summary=WASTE_TYPE_TO_DESCRIPTION[next_waste_pickup_type],
start=next_waste_pickup_date,
end=next_waste_pickup_date,
end=next_waste_pickup_date + timedelta(days=1),
)
super()._handle_coordinator_update()

View file

@ -12,7 +12,7 @@
dict({
'description': None,
'end': dict({
'date': '2022-01-06',
'date': '2022-01-07',
}),
'location': None,
'recurrence_id': None,
@ -30,7 +30,7 @@
'attributes': ReadOnlyDict({
'all_day': True,
'description': '',
'end_time': '2022-01-06 00:00:00',
'end_time': '2022-01-07 00:00:00',
'friendly_name': 'Twente Milieu',
'icon': 'mdi:delete-empty',
'location': '',