Fix due status calculation

Signed-off-by: Raul <raul@nextcloud.com>
This commit is contained in:
Raul
2022-05-09 14:44:36 +02:00
committed by Julius Härtl
parent 99f5e8b76e
commit 7575bd0bf7
4 changed files with 17 additions and 16 deletions

View File

@@ -158,11 +158,14 @@ class Card extends RelationalEntity {
return $calendar;
}
public function getDaysUntilDue(): int {
public function getDaysUntilDue(): ?int {
$today = new DateTime();
$today->setTime(0, 0);
$match_date = $this->getDuedate();
if ($match_date === null) {
return null;
}
$match_date = $this->getDueDateTime() ?? new DateTime();
$today->setTime(0, 0);
$match_date->setTime(0, 0);
$diff = $today->diff($match_date);