Skip to content
Snippets Groups Projects
Commit 2e5fd968 authored by Owen Bush's avatar Owen Bush
Browse files

Fixed issue with time display of events in a series

parent 0ac37362
No related branches found
No related tags found
No related merge requests found
......@@ -98,12 +98,16 @@ class EventInstanceDateFormatter extends EntityReferenceFormatterBase {
foreach ($this->getEntitiesToView($items, $langcode) as $delta => $entity) {
$date_string = '';
$user_timezone = new \DateTimeZone(drupal_get_user_timezone());
if (!empty($entity->date->start_date) && !empty($entity->date->end_date)) {
/** @var \Drupal\Core\Datetime\DrupalDateTime $start_date */
$start_date = $entity->date->start_date;
/** @var \Drupal\Core\Datetime\DrupalDateTime $end_date */
$end_date = $entity->date->end_date;
$start_date->setTimezone($user_timezone);
$end_date->setTimezone($user_timezone);
$date = [];
$date[] = $start_date->format($this->getSetting('date_format'));
$date[] = $end_date->format($this->getSetting('date_format'));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment