This commit is contained in:
G Johansson
2025-08-13 20:00:55 +00:00
parent e577172832
commit 56c35eedd4
2 changed files with 9 additions and 4 deletions

View File

@@ -97,4 +97,8 @@ class WorkdayCalendarEntity(BaseWorkdayEntity, CalendarEntity):
self, hass: HomeAssistant, start_date: datetime, end_date: datetime
) -> list[CalendarEvent]:
"""Get all events in a specific time frame."""
return self.event_list
return [
workday
for workday in self.event_list
if start_date.date() <= workday.start <= end_date.date()
]

View File

@@ -40,14 +40,15 @@ async def test_holiday_calendar_entity(
SERVICE_GET_EVENTS,
{
"entity_id": "calendar.workday_sensor_calendar",
"end_date_time": dt_util.now() + timedelta(hours=1),
"start_date_time": dt_util.now(),
"end_date_time": dt_util.now() + timedelta(days=10, hours=1),
},
blocking=True,
return_response=True,
)
assert {
"end": "2023-01-01",
"start": "2023-01-02",
"end": "2023-01-02",
"start": "2023-01-01",
"summary": "Workday Sensor",
} not in response["calendar.workday_sensor_calendar"]["events"]
assert {