fix(genetic): date a run in progress in the time zone of the horizon

The start day of a run in progress decides which DAILY cycle it counts
for. Take it in the time zone of slot 0, which also dates the cycles.

The cycle counting test gave its times with a +01:00 offset, so on a
runner in UTC the run started on the previous day and was rightly not
counted for today. It now uses local times without offset and passes in
local time zones from UTC-12 to UTC+14.

Refs: #1548
Signed-off-by: SchaafAlexander <86607129+SchaafAlexander@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-by: Claude Code (claude-opus-5-5)
This commit is contained in:
SchaafAlexander
2026-11-15 13:54:22 +01:00
committed by Bobby Noelte
co-authored by Claude Opus 5.5
parent 4693e1fa97
commit e40ff7f6e3
2 changed files with 14 additions and 6 deletions
@@ -483,7 +483,11 @@ class HomeAppliance:
)
self.pinned_start_datetime = started
self.pinned_end_datetime = max(started.add(seconds=self.run_duration_seconds), now)
self.pinned_run_date = started.date()
# The start day in the time zone of the horizon, which also dates the cycles.
horizon_timezone = slot0_datetime.timezone
self.pinned_run_date = (
started.in_timezone(horizon_timezone) if horizon_timezone is not None else started
).date()
if elapsed >= self.run_duration_seconds:
logger.info(
"Home appliance '{}': run started {} is past its duration of {} s "