fixed reminder

This commit is contained in:
2026-06-11 12:34:35 +03:00
parent 41cbef61a9
commit 66e1b0e29e
7 changed files with 104 additions and 19 deletions
+12 -1
View File
@@ -14,7 +14,14 @@ RECURRENCE_NONE = "none"
RECURRENCE_DAILY = "daily"
RECURRENCE_WEEKLY = "weekly"
RECURRENCE_MONTHLY = "monthly"
VALID_RECURRENCE = frozenset({RECURRENCE_NONE, RECURRENCE_DAILY, RECURRENCE_WEEKLY, RECURRENCE_MONTHLY})
RECURRENCE_YEARLY = "yearly"
VALID_RECURRENCE = frozenset({
RECURRENCE_NONE,
RECURRENCE_DAILY,
RECURRENCE_WEEKLY,
RECURRENCE_MONTHLY,
RECURRENCE_YEARLY,
})
def _utcnow() -> datetime:
@@ -50,6 +57,10 @@ def _advance_due(due_at: datetime, recurrence: str) -> datetime:
year += 1
day = min(due_at.day, calendar.monthrange(year, month)[1])
return due_at.replace(year=year, month=month, day=day)
if recurrence == RECURRENCE_YEARLY:
year = due_at.year + 1
day = min(due_at.day, calendar.monthrange(year, due_at.month)[1])
return due_at.replace(year=year, day=day)
return due_at