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
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 3m45s
This commit is contained in:
@@ -62,7 +62,7 @@ def get_expiring_chores_for_user(
|
||||
|
||||
try:
|
||||
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:
|
||||
local_now = now_dt
|
||||
|
||||
@@ -106,10 +106,15 @@ def get_expiring_chores_for_user(
|
||||
continue # Anytime — no expiry
|
||||
|
||||
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(
|
||||
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
|
||||
if not (local_now < deadline_dt <= window_end):
|
||||
|
||||
Reference in New Issue
Block a user