summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-04-26 10:31:57 +0400
committerAndrew Dolgov <[email protected]>2013-04-26 10:31:57 +0400
commit6bfc97da869ca180d2f5fee01c9ff503cb47b1bd (patch)
treec495b5ac3d3701399cf657615de8c5f221d6f74e /include
parent5ddef5ba238ad8bdfc23344b3bb3297067eb1747 (diff)
add automatic timezone (based on client tz offset)
Diffstat (limited to 'include')
-rw-r--r--include/functions.php17
1 files changed, 11 insertions, 6 deletions
diff --git a/include/functions.php b/include/functions.php
index b54187e18..4272c649d 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -862,13 +862,18 @@
$user_tz_string = get_pref('USER_TIMEZONE', $owner_uid);
- try {
- if (!$user_tz) $user_tz = new DateTimeZone($user_tz_string);
- } catch (Exception $e) {
- $user_tz = $utc_tz;
- }
+ if ($user_tz_string != 'Automatic') {
- $tz_offset = $user_tz->getOffset($dt);
+ try {
+ if (!$user_tz) $user_tz = new DateTimeZone($user_tz_string);
+ } catch (Exception $e) {
+ $user_tz = $utc_tz;
+ }
+
+ $tz_offset = $user_tz->getOffset($dt);
+ } else {
+ $tz_offset = (int) $_SESSION["clientTzOffset"];
+ }
$user_timestamp = $dt->format('U') + $tz_offset;