Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions todoman/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,22 @@ def is_completed(self) -> bool:
def is_recurring(self) -> bool:
return bool(self.rrule)

def _apply_recurrence_to_dt(self, dt: date | None) -> datetime | None:
def _apply_recurrence_to_dt(self, dt: date | None) -> date | datetime | None:
if not dt:
return None

assert self.rrule is not None, "applying recurrence to todo without rrule"
recurrence = rrulestr(self.rrule, dtstart=dt)

if isinstance(dt, date) and not isinstance(dt, datetime):
if dateonly := not isinstance(dt, datetime):
dt = datetime.combine(dt, time.min)

return recurrence.after(dt)
nxt = recurrence.after(dt)
Comment thread
dme marked this conversation as resolved.

if dateonly and nxt is not None:
return nxt.date()

return nxt

def _create_next_instance(self) -> Todo:
copy = self.clone()
Expand Down