1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 23:25:56 +00:00

add automatic timezone (based on client tz offset)

This commit is contained in:
Andrew Dolgov
2013-04-26 10:31:57 +04:00
parent 5ddef5ba23
commit 6bfc97da86
5 changed files with 19 additions and 7 deletions

View File

@@ -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;