Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OEL-2825: Event teaser timezone. #257

Open
wants to merge 1 commit into
base: 1.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -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'] += [
Expand Down