mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 22:07:29 -08:00
Fixed #6922 - date_add crashing if EOL is null
This commit is contained in:
parent
420e8bc85a
commit
1bb1f7342f
|
@ -391,7 +391,7 @@ class AssetPresenter extends Presenter
|
||||||
public function eol_date()
|
public function eol_date()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (( $this->purchase_date ) && ( $this->model )) {
|
if (( $this->purchase_date ) && ( $this->model ) && ($this->model->model->eol) ) {
|
||||||
$date = date_create($this->purchase_date);
|
$date = date_create($this->purchase_date);
|
||||||
date_add($date, date_interval_create_from_date_string($this->model->model->eol . ' months'));
|
date_add($date, date_interval_create_from_date_string($this->model->model->eol . ' months'));
|
||||||
return date_format($date, 'Y-m-d');
|
return date_format($date, 'Y-m-d');
|
||||||
|
|
Loading…
Reference in a new issue