Skip to content

Commit

Permalink
Merge pull request #58 from chamook/events-date-range
Browse files Browse the repository at this point in the history
Handle start and end date in async_get_events
  • Loading branch information
briis authored Mar 26, 2024
2 parents 78b287b + 23fcef6 commit 4bde8fe
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions custom_components/affalddk/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ async def async_get_events(self, hass: HomeAssistant, start_date: datetime.datet

_pickup_events: PickupType = self._coordinator.data.pickup_events.get(item) if self._coordinator.data.pickup_events else None

if start_date.date() > _pickup_events.date:
continue
if end_date.date() < _pickup_events.date:
continue

_summary = NAME_LIST.get(item)
_start: datetime.date = _pickup_events.date
_end: datetime.date = _start + timedelta(days=1)
Expand Down

0 comments on commit 4bde8fe

Please sign in to comment.