fix: daily, weekly and monthly automations can run twice or skip their first run (#32264)

Automations scheduled with the Daily, Weekly or Monthly picker ran a few seconds after the chosen time, taking the seconds from whenever the previous run was handled. Now and then that left the next run due again within the same minute, and the automation ran twice. Users whose timezone is behind the server's could also have their first run moved to the next day. These schedules now run at the exact minute chosen, in the user's own timezone.

Fixes #32263
This commit is contained in:
Classic298 2026-10-12 16:51:03 +02:00 • committed by GitHub
parent 6f92cd78ee
commit c89336da5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -64,6 +64,9 @@ def _parse_rule(s: str, now: Optional[datetime] = None):
}.get(rule._freq)
if step is None:
# dateutil's default anchor carries seconds and the server timezone
if not has_dtstart:
return rrulestr(stripped, dtstart=anchor.replace(second=0, microsecond=0), ignoretz=True)
if not rule._dtstart.tzinfo:
return parsed
return rrulestr(stripped, dtstart=start, ignoretz=True)