Skip to content

Commit 44d2246

Browse files
committed
Fix custom timezone
1 parent 1c7205d commit 44d2246

File tree

3 files changed

+60
-67
lines changed

3 files changed

+60
-67
lines changed

featherbb/Controller/Admin/Options.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,17 @@ public function display($req, $res, $args)
4040

4141
AdminUtils::generateAdminMenu('admin options');
4242

43+
$diff = (User::getPref('timezone') + User::getPref('dst')) * 3600;
44+
$timestamp = time() + $diff;
45+
4346
View::setPageInfo([
4447
'title' => [Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Admin options')],
4548
'active_page' => 'admin',
4649
'admin_console' => true,
4750
'languages' => $this->model->languages(),
4851
'styles' => $this->model->styles(),
4952
'times' => $this->model->times(),
53+
'timestamp' => $timestamp
5054
]
5155
)->addTemplate('@forum/admin/options')->display();
5256
}

featherbb/Core/Utils.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,13 @@ public static function formatTime($timestamp, $dateOnly = false, $dateFormat = n
9090
$now = time();
9191

9292
if (is_null($dateFormat)) {
93-
$dateFormat = User::getPref('date_format');
93+
$availableDateFormats = Container::get('forum_date_formats');
94+
$dateFormat = $availableDateFormats[User::getPref('date_format')];
9495
}
9596

9697
if (is_null($timeFormat)) {
97-
$timeFormat = User::getPref('time_format');
98+
$availableTimeFormats = Container::get('forum_time_formats');
99+
$timeFormat = $availableTimeFormats[User::getPref('time_format')];
98100
}
99101

100102
$date = gmdate($dateFormat, $timestamp);

0 commit comments

Comments
 (0)