diff options
author | Raul <raul@nextcloud.com> | 2022-05-03 14:00:51 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2022-11-11 17:47:06 +0300 |
commit | dd9e7e240fcbf055520ba723ed7dab1838328ff4 (patch) | |
tree | c5bc04cd214f0f63ec5566f1ff465a80ad40e610 | |
parent | 0a30b73f103da0685ffea17b63a4fdbf2bd96aed (diff) |
Add phpDoc typehints for magic methods
Signed-off-by: Raul <raul@nextcloud.com>
-rw-r--r-- | lib/Db/Card.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Db/Card.php b/lib/Db/Card.php index ed710d71..b866fd3e 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'; } |