Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

show cron execution with timezone

ayntk-ai883a52afe985
diff --git a/app/Livewire/Project/Shared/ScheduledTask/Executions.php b/app/Livewire/Project/Shared/ScheduledTask/Executions.php
index 3ee053e3ee..0f26523cb1 100644
--- a/app/Livewire/Project/Shared/ScheduledTask/Executions.php
+++ b/app/Livewire/Project/Shared/ScheduledTask/Executions.php
@@ -27,11 +27,28 @@ class Executions extends Component
$this->selectedKey = $key;
}
+ public function server()
+ {
+ return $this->destination->server;
+ }
+
public function getServerTimezone()
{
- $server = data_get($this, 'destination.server');
- $serverTimezone = $server->settings->server_timezone;
+ $server = $this->server();
+ $serverTimezone = $server->settings->server_timezone ?: config('app.timezone');
ray('Server Timezone:', $serverTimezone);
return $serverTimezone;
}
+
+ public function formatDateInServerTimezone($date)
+ {
+ $serverTimezone = $this->getServerTimezone();
+ $dateObj = new \DateTime($date);
+ try {
+ $dateObj->setTimezone(new \DateTimeZone($serverTimezone));
+ } catch (\Exception $e) {
+ ray('Invalid timezone:', $serverTimezone);
+ }
+ return $dateObj->format('Y-m-d H:i:s T');
+ }
}
\ No newline at end of file
diff --git a/app/Livewire/Settings/Index.php b/app/Livewire/Settings/Index.php
index f593fb78b0..eff09f0e51 100644
--- a/app/Livewire/Settings/Index.php
+++ b/app/Livewire/Settings/Index.php
@@ -40,6 +40,7 @@ class Index extends Component
'settings.is_auto_update_enabled' => 'boolean',
'auto_update_frequency' => 'string',
'update_check_frequency' => 'string',
+ 'settings.instance_timezone' => 'required|string|timezone',
];
protected $validationAttributes = [
@@ -54,6 +55,8 @@ class Index extends Component
'update_check_frequency' => 'Update Check Frequency',
];
+ public $timezones;
+
public function mount()
{
if (isInstanceAdmin()) {
@@ -65,6 +68,7 @@ class Index extends Component
$this->is_api_enabled = $this->settings->is_api_enabled;
$this->auto_update_frequency = $this->settings->auto_update_frequency;
$this->update_check_frequency = $this->settings->update_check_frequency;
+ $this->timezones = collect(timezone_identifiers_list())->sort()->values()->toArray();
} else {
return redirect()->route('dashboard');
}
@@ -170,4 +174,4 @@ class Index extends Component
{
return view('livewire.settings.index');
}
-}
+}
\ No newline at end of file