From 146182af27432f2795d7ff63d6ce377781bb18ac Mon Sep 17 00:00:00 2001 From: vincent-gao Date: Mon, 14 Oct 2024 14:03:32 +1100 Subject: [PATCH] modified localDateAndTimeFormatter (#522) --- .../tide_landing_page/src/Helper/TideLandingPageHelper.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/tide_landing_page/src/Helper/TideLandingPageHelper.php b/modules/tide_landing_page/src/Helper/TideLandingPageHelper.php index db500fc10..150e20a79 100644 --- a/modules/tide_landing_page/src/Helper/TideLandingPageHelper.php +++ b/modules/tide_landing_page/src/Helper/TideLandingPageHelper.php @@ -26,9 +26,8 @@ public static function localDateAndTimeFormatter($date) { $drupal_date_time = new DrupalDateTime($date, $storage_tz); // Convert to local timezone. $system_tz = \Drupal::service('config.factory')->get('system.date')->get('timezone.default'); - $date_formatter = \Drupal::service('date.formatter'); - $converted_date = $date_formatter->format($drupal_date_time->getTimeStamp(), 'custom', 'Y-m-d H:i:s', $system_tz); - return $converted_date; + $drupal_date_time->setTimezone(new \DateTimeZone($system_tz)); + return $drupal_date_time->format(\DateTime::ATOM); } }