From 7932e0394e539e9e0cfc0bf4830f262db83fb3f0 Mon Sep 17 00:00:00 2001
From: Christian Wach <needle@haystack.co.uk>
Date: Tue, 4 Jun 2013 18:47:42 +0100
Subject: [PATCH] added functionality from commit
 38f1b6f321526d4ab19058861e1f9569a67f8bce

---
 civicrm.php | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/civicrm.php b/civicrm.php
index 761c35f..7a8ce44 100644
--- a/civicrm.php
+++ b/civicrm.php
@@ -437,6 +437,16 @@ class CiviCRM_For_WordPress {
 			return '';
 		}
 
+		// CRM-12523
+		// WordPress has it's own timezone calculations
+		// Civi relies on the php default timezone which WP
+		// overrides with UTC in wp-settings.php
+		$wpBaseTimezone = date_default_timezone_get();
+		$wpUserTimezone = get_option('timezone_string');
+		if ($wpUserTimezone) {
+			date_default_timezone_set($wpUserTimezone);
+		}
+
 		// Add our standard css & js
 		CRM_Core_Resources::singleton()->addCoreResources();
 
@@ -470,6 +480,11 @@ class CiviCRM_For_WordPress {
 		// do the business
 		CRM_Core_Invoke::invoke($args);
 
+		// restore WP's timezone
+		if ($wpBaseTimezone) {
+			date_default_timezone_set($wpBaseTimezone);
+		}
+
 		// notify plugins
 		do_action( 'civicrm_invoked' );
 		
-- 
GitLab