Skip to content

Commit

Permalink
Add check for real null dates, code style
Browse files Browse the repository at this point in the history
  • Loading branch information
richard67 committed Oct 23, 2019
1 parent e2b623c commit 0fd6efe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ public function getItems()

foreach ($dateProperties as $dateProperty)
{
if (array_key_exists($dateProperty, $object->data) && $object->data->$dateProperty->value != $nullDate)
if (array_key_exists($dateProperty, $object->data)
&& $object->data->$dateProperty->value !== null
&& $object->data->$dateProperty->value !== $nullDate)
{
$object->data->$dateProperty->value = HTMLHelper::_(
'date',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,15 @@ public function getItem($pk = null)

foreach ($dateProperties as $dateProperty)
{
if (array_key_exists($dateProperty, $result->data) && $result->data->$dateProperty->value != $nullDate)
if (array_key_exists($dateProperty, $result->data)
&& $result->data->$dateProperty->value !== null
&& $result->data->$dateProperty->value !== $nullDate)
{
$result->data->$dateProperty->value = HTMLHelper::_('date', $result->data->$dateProperty->value, Text::_('DATE_FORMAT_LC6'));
$result->data->$dateProperty->value = HTMLHelper::_(
'date',
$result->data->$dateProperty->value,
Text::_('DATE_FORMAT_LC6')
);
}
}

Expand Down

0 comments on commit 0fd6efe

Please sign in to comment.