Commit 8d3df4d7 authored by alexpott's avatar alexpott

Issue #2858625 by mpdonadio: Daterange formatters should use...

Issue #2858625 by mpdonadio: Daterange formatters should use $date->getTimestamp() instead of $date->format('U')
parent ac7313dd
......@@ -23,7 +23,7 @@ public function viewElements(FieldItemListInterface $items, $langcode) {
/** @var \Drupal\Core\Datetime\DrupalDateTime $end_date */
$end_date = $item->end_date;
if ($start_date->format('U') !== $end_date->format('U')) {
if ($start_date->getTimestamp() !== $end_date->getTimestamp()) {
$elements[$delta] = [
'start_date' => $this->buildDateWithIsoAttribute($start_date),
'separator' => ['#plain_text' => ' ' . $separator . ' '],
......
......@@ -48,7 +48,7 @@ public function viewElements(FieldItemListInterface $items, $langcode) {
/** @var \Drupal\Core\Datetime\DrupalDateTime $end_date */
$end_date = $item->end_date;
if ($start_date->format('U') !== $end_date->format('U')) {
if ($start_date->getTimestamp() !== $end_date->getTimestamp()) {
$elements[$delta] = [
'start_date' => $this->buildDate($start_date),
'separator' => ['#plain_text' => ' ' . $separator . ' '],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment