mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Added check for purchase date
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
63f0b5279d
commit
adf58a06da
|
@ -158,17 +158,20 @@ class Depreciable extends SnipeModel
|
||||||
|
|
||||||
public function time_until_depreciated()
|
public function time_until_depreciated()
|
||||||
{
|
{
|
||||||
// @link http://www.php.net/manual/en/class.datetime.php
|
if ($this->depreciated_date()) {
|
||||||
$d1 = new \DateTime();
|
// @link http://www.php.net/manual/en/class.datetime.php
|
||||||
$d2 = $this->depreciated_date();
|
$d1 = new \DateTime();
|
||||||
|
$d2 = $this->depreciated_date();
|
||||||
|
|
||||||
// @link http://www.php.net/manual/en/class.dateinterval.php
|
// @link http://www.php.net/manual/en/class.dateinterval.php
|
||||||
$interval = $d1->diff($d2);
|
$interval = $d1->diff($d2);
|
||||||
if (! $interval->invert) {
|
if (! $interval->invert) {
|
||||||
return $interval;
|
return $interval;
|
||||||
} else {
|
} else {
|
||||||
return new \DateInterval('PT0S'); //null interval (zero seconds from now)
|
return new \DateInterval('PT0S'); //null interval (zero seconds from now)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function depreciated_date()
|
public function depreciated_date()
|
||||||
|
|
Loading…
Reference in a new issue