Remove most calls to date_default_timezone_* calls
- It was wrongly used to set the node-wide ot user-specific timezone - It is now fully managed from the App object - Add a static variable to DateTimeFormat maintain the convenient local() method
This commit is contained in:
parent
08c24fd4fa
commit
6db211568a
11 changed files with 35 additions and 36 deletions
|
@ -100,9 +100,9 @@ function events_post(App $a)
|
|||
}
|
||||
|
||||
if ($adjust) {
|
||||
$start = DateTimeFormat::convert($start, 'UTC', date_default_timezone_get());
|
||||
$start = DateTimeFormat::convert($start, 'UTC', $a->getTimeZone());
|
||||
if (!$nofinish) {
|
||||
$finish = DateTimeFormat::convert($finish, 'UTC', date_default_timezone_get());
|
||||
$finish = DateTimeFormat::convert($finish, 'UTC', $a->getTimeZone());
|
||||
}
|
||||
} else {
|
||||
$start = DateTimeFormat::utc($start);
|
||||
|
@ -481,9 +481,9 @@ function events_content(App $a)
|
|||
$sdt = $orig_event['start'] ?? 'now';
|
||||
$fdt = $orig_event['finish'] ?? 'now';
|
||||
|
||||
$tz = date_default_timezone_get();
|
||||
$tz = $a->getTimeZone();
|
||||
if (isset($orig_event['adjust'])) {
|
||||
$tz = ($orig_event['adjust'] ? date_default_timezone_get() : 'UTC');
|
||||
$tz = ($orig_event['adjust'] ? $a->getTimeZone() : 'UTC');
|
||||
}
|
||||
|
||||
$syear = DateTimeFormat::convert($sdt, $tz, 'UTC', 'Y');
|
||||
|
|
|
@ -686,7 +686,7 @@ function item_post(App $a) {
|
|||
Hook::callAll('post_local',$datarray);
|
||||
|
||||
if (!empty($_REQUEST['scheduled_at'])) {
|
||||
$scheduled_at = DateTimeFormat::convert($_REQUEST['scheduled_at'], 'UTC', $a->getTimezone());
|
||||
$scheduled_at = DateTimeFormat::convert($_REQUEST['scheduled_at'], 'UTC', $a->getTimeZone());
|
||||
if ($scheduled_at > DateTimeFormat::utcNow()) {
|
||||
unset($datarray['created']);
|
||||
unset($datarray['edited']);
|
||||
|
|
|
@ -333,7 +333,7 @@ function settings_post(App $a)
|
|||
}
|
||||
|
||||
if (($timezone != $user['timezone']) && strlen($timezone)) {
|
||||
date_default_timezone_set($timezone);
|
||||
$a->setTimeZone($timezone);
|
||||
}
|
||||
|
||||
$aclFormatter = DI::aclFormatter();
|
||||
|
@ -601,7 +601,7 @@ function settings_content(App $a)
|
|||
$expire_network_only = DI::pConfig()->get(local_user(), 'expire', 'network_only', false);
|
||||
|
||||
if (!strlen($user['timezone'])) {
|
||||
$timezone = date_default_timezone_get();
|
||||
$timezone = $a->getTimeZone();
|
||||
}
|
||||
|
||||
// Set the account type to "Community" when the page is a community page but the account type doesn't fit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue