/**
* {@inheritdoc}
*/
public function viewElements(FieldItemListInterface
$items,
$langcode) { $elements =
[];
foreach ($items as $delta =>
$item) { $date =
$item->date;
$output =
[];
if (!
empty($item->date
)) { $output =
$this->
formatDate($date);
} $elements[$delta] =
$output;
} return $elements;
} /**
* Formats a date/time as a time interval.
*
* @param \Drupal\Core\Datetime\DrupalDateTime|object $date
* A date/time object.
*
* @return array
* The formatted date/time string using the past or future format setting.
*/