fix UI of cron jobs
This commit is contained in:
parent
7a001cea3b
commit
80b90b3a2c
1 changed files with 3 additions and 17 deletions
|
|
@ -29,37 +29,25 @@ public function selectTask($key): void
|
|||
|
||||
public function server()
|
||||
{
|
||||
ray('Entering server() In UI');
|
||||
|
||||
if (!$this->task) {
|
||||
ray('No task found, returning null');
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($this->task->application) {
|
||||
ray('Returning server from application');
|
||||
return $this->task->application->server;
|
||||
} elseif ($this->task->database) {
|
||||
ray('Returning server from database');
|
||||
return $this->task->database->server;
|
||||
} elseif ($this->task->service) {
|
||||
ray('Returning server from service');
|
||||
return $this->task->service->server;
|
||||
}
|
||||
|
||||
ray('No server found, returning null');
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public function getServerTimezone()
|
||||
{
|
||||
$server = $this->server();
|
||||
if (!$server) {
|
||||
ray('No server found, returning default timezone');
|
||||
return 'UTC';
|
||||
}
|
||||
$serverTimezone = $server->settings->server_timezone ?? 'UTC';
|
||||
ray('Server Timezone:', $serverTimezone);
|
||||
$serverTimezone = $server->settings->server_timezone;
|
||||
return $serverTimezone;
|
||||
}
|
||||
|
||||
|
|
@ -70,10 +58,8 @@ public function formatDateInServerTimezone($date)
|
|||
try {
|
||||
$dateObj->setTimezone(new \DateTimeZone($serverTimezone));
|
||||
} catch (\Exception $e) {
|
||||
ray('Invalid timezone:', $serverTimezone);
|
||||
// Fallback to UTC
|
||||
$dateObj->setTimezone(new \DateTimeZone('UTC'));
|
||||
}
|
||||
return $dateObj->format('Y-m-d H:i:s T');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue