fix: adjust timezone handling for chore expiry notifications and ensure deadlines account for next occurrences
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 3m45s

This commit is contained in:
2026-07-17 19:47:43 -04:00
parent d910a6bc65
commit f7b00fc7c4
@@ -62,7 +62,7 @@ def get_expiring_chores_for_user(
try: try:
from zoneinfo import ZoneInfo from zoneinfo import ZoneInfo
local_now = datetime.now(ZoneInfo(tz_str)) if tz_str else now_dt local_now = now_dt.astimezone(ZoneInfo(tz_str)) if tz_str else now_dt
except Exception: except Exception:
local_now = now_dt local_now = now_dt
@@ -106,10 +106,15 @@ def get_expiring_chores_for_user(
continue # Anytime — no expiry continue # Anytime — no expiry
due_hour, due_minute = due due_hour, due_minute = due
# Build a timezone-aware deadline datetime for today # Build a timezone-aware deadline datetime for the next occurrence of the due time.
# Schedules run hourly and may span midnight (e.g. a 23:00 run needs to catch
# a chore due at 00:15 the next day), so roll forward a day when the candidate
# deadline has already passed.
deadline_dt = local_now.replace( deadline_dt = local_now.replace(
hour=due_hour, minute=due_minute, second=0, microsecond=0 hour=due_hour, minute=due_minute, second=0, microsecond=0
) )
if deadline_dt <= local_now:
deadline_dt = deadline_dt + timedelta(days=1)
# Include only when deadline is strictly after now and within window # Include only when deadline is strictly after now and within window
if not (local_now < deadline_dt <= window_end): if not (local_now < deadline_dt <= window_end):