diff --git a/app/Presenters/AssetPresenter.php b/app/Presenters/AssetPresenter.php index 689a87201a..144ed4d75b 100644 --- a/app/Presenters/AssetPresenter.php +++ b/app/Presenters/AssetPresenter.php @@ -492,9 +492,13 @@ class AssetPresenter extends Presenter */ public function warrantee_expires() { - $date = date_create($this->purchase_date); - date_add($date, date_interval_create_from_date_string($this->warranty_months . ' months')); - return date_format($date, 'Y-m-d'); + if (($this->purchase_date) && ($this->warranty_months)) { + $date = date_create($this->purchase_date); + date_add($date, date_interval_create_from_date_string($this->warranty_months . ' months')); + return date_format($date, 'Y-m-d'); + } + + return false; } /**