diff --git a/lib/Db/Card.php b/lib/Db/Card.php index ed710d716..b866fd3e3 100644 --- a/lib/Db/Card.php +++ b/lib/Db/Card.php @@ -158,6 +158,17 @@ class Card extends RelationalEntity { return $calendar; } + public function getDaysUntilDue(): int { + $today = new DateTime(); + $today->setTime(0, 0); + + $match_date = $this->getDueDateTime() ?? new DateTime(); + $match_date->setTime(0, 0); + + $diff = $today->diff($match_date); + return (int) $diff->format('%R%a'); // Extract days count in interval + } + public function getCalendarPrefix(): string { return 'card'; }