Skip to content

Commit

Permalink
modified localDateAndTimeFormatter (#522)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-gao authored Oct 14, 2024
1 parent 14943e3 commit 146182a
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 146182a

Please sign in to comment.