From 27fd3fa368ff780478470286d29a316853414c73 Mon Sep 17 00:00:00 2001 From: Julien Tekrane Date: Mon, 12 Feb 2024 15:34:28 +0000 Subject: [PATCH] OEL-2825: Event teaser timezone. --- .../oe_whitelabel_starter_event.module | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/oe_whitelabel_starter_event/oe_whitelabel_starter_event.module b/modules/oe_whitelabel_starter_event/oe_whitelabel_starter_event.module index 3fcde2001..cdae41daa 100755 --- a/modules/oe_whitelabel_starter_event/oe_whitelabel_starter_event.module +++ b/modules/oe_whitelabel_starter_event/oe_whitelabel_starter_event.module @@ -189,6 +189,9 @@ function _oe_whitelabel_starter_event_preprocess_date(array &$variables): void { $dates = $node->get('oe_sc_event_dates')->first(); /** @var \Drupal\Core\Datetime\DrupalDateTime $start */ $start = $dates->get('start_date')->getValue(); + $timezone = \Drupal::config('system.date')->get('timezone.default'); + $start->setTimezone(new DateTimeZone($timezone)); + $variables['date_block'] = [ 'year' => $start->format('Y'), 'month' => $start->format('M'), @@ -197,6 +200,7 @@ function _oe_whitelabel_starter_event_preprocess_date(array &$variables): void { ]; /** @var \Drupal\Core\Datetime\DrupalDateTime $end */ $end = $dates->get('end_date')->getValue(); + $end->setTimezone(new DateTimeZone($timezone)); if (!empty($end) && $start->format('d-m-y') !== $end->format('d-m-y')) { $variables['date_block'] += [