Default to UTC when no timezone set so that montagereview continues working. Fixes #3274

This commit is contained in:
Isaac Connor 2021-06-02 18:34:26 -04:00
parent 74b48c9f21
commit 959107f318
1 changed files with 7 additions and 1 deletions

View File

@ -1,6 +1,12 @@
var server_utc_offset = <?php
$TimeZone = new DateTimeZone( ini_get('date.timezone') );
$tz = ini_get('date.timezone');
if (!$tz) {
$tz = 'UTC';
Warning('Timezone has not been set. Either select it in Options->System->Timezone or in php.ini');
}
$TimeZone = new DateTimeZone($tz);
$now = new DateTime('now', $TimeZone);
$offset = $TimeZone->getOffset($now);
echo $offset.'; // '.floor($offset / 3600).' hours ';