From 47e418fee269f5a9cb6fb7a009462e32baeecc3c Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Tue, 24 Mar 2015 11:35:18 +0000
Subject: [PATCH] Issue #2457251 by vijaycs85: Remove unnecessary call to
 drupal_get_user_timezone() in
 Drupal/Core/Datetime/DrupalDateTime::prepareTimezone() method

---
 core/lib/Drupal/Core/Datetime/DrupalDateTime.php | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/core/lib/Drupal/Core/Datetime/DrupalDateTime.php b/core/lib/Drupal/Core/Datetime/DrupalDateTime.php
index ac22dab03c95..74bd68b9f2ee 100644
--- a/core/lib/Drupal/Core/Datetime/DrupalDateTime.php
+++ b/core/lib/Drupal/Core/Datetime/DrupalDateTime.php
@@ -62,9 +62,9 @@ public function __construct($time = 'now', $timezone = NULL, $settings = array()
    * knowledge of the preferred user timezone.
    */
   protected function prepareTimezone($timezone) {
-    $user_timezone = drupal_get_user_timezone();
-    if (empty($timezone) && !empty($user_timezone)) {
-      $timezone = $user_timezone;
+    if (empty($timezone)) {
+      // Fallback to user or system default timezone.
+      $timezone = drupal_get_user_timezone();
     }
     return parent::prepareTimezone($timezone);
   }
-- 
GitLab