days ahead

This commit is contained in:
G Johansson
2025-08-13 19:45:04 +00:00
parent 70714ec9e6
commit e577172832

View File

@@ -15,6 +15,8 @@ from . import WorkdayConfigEntry
from .const import CONF_EXCLUDES, CONF_OFFSET, CONF_WORKDAYS from .const import CONF_EXCLUDES, CONF_OFFSET, CONF_WORKDAYS
from .entity import BaseWorkdayEntity from .entity import BaseWorkdayEntity
CALENDAR_DAYS_AHEAD = 365
async def async_setup_entry( async def async_setup_entry(
hass: HomeAssistant, hass: HomeAssistant,
@@ -71,7 +73,7 @@ class WorkdayCalendarEntity(BaseWorkdayEntity, CalendarEntity):
def update_data(self, now: datetime) -> None: def update_data(self, now: datetime) -> None:
"""Update data.""" """Update data."""
event_list = [] event_list = []
for i in range(365): for i in range(CALENDAR_DAYS_AHEAD):
future_date = now.date() + timedelta(days=i) future_date = now.date() + timedelta(days=i)
if self.date_is_workday(future_date): if self.date_is_workday(future_date):
event = CalendarEvent( event = CalendarEvent(