Skip to content

Commit c09337e

Browse files
authored
[Chore] Added page to debug time zone issue (alexjustesen#946)
1 parent e8b57b2 commit c09337e

File tree

8 files changed

+138
-2
lines changed

8 files changed

+138
-2
lines changed

app/Livewire/Debug/Timezone.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace App\Livewire\Debug;
4+
5+
use App\Settings\GeneralSettings;
6+
use Livewire\Attributes\Layout;
7+
use Livewire\Component;
8+
9+
#[Layout('layouts.debug')]
10+
class Timezone extends Component
11+
{
12+
public $settings;
13+
14+
public function mount()
15+
{
16+
$settings = new GeneralSettings();
17+
18+
$this->settings = $settings->toArray();
19+
}
20+
21+
public function render()
22+
{
23+
return view('livewire.debug.timezone');
24+
}
25+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace App\View\Components;
4+
5+
use Closure;
6+
use Illuminate\Contracts\View\View;
7+
use Illuminate\View\Component;
8+
9+
class DebugLayout extends Component
10+
{
11+
/**
12+
* Get the view / contents that represent the component.
13+
*/
14+
public function render(): View|Closure|string
15+
{
16+
return view('layouts.app');
17+
}
18+
}
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"resources/css/app.css": {
3-
"file": "assets/app-a1b0d14f.css",
3+
"file": "assets/app-2a095b76.css",
44
"isEntry": true,
55
"src": "resources/css/app.css"
66
},
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!DOCTYPE html>
2+
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" class="h-full">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
7+
<title>Timezone - {{ config('app.name') }}</title>
8+
9+
{{-- Fonts --}}
10+
<link href="{{ asset('fonts/inter/inter.css') }}" rel="stylesheet" />
11+
12+
{{-- Styles --}}
13+
@filamentStyles
14+
@vite('resources/css/app.css')
15+
</head>
16+
<body class="min-h-screen antialiased bg-gray-50 text-gray-950">
17+
<main class="max-w-xl p-4 mx-auto space-y-4 sm:p-6 lg:p-8 sm:space-y-8">
18+
@if (isset($header))
19+
{{ $header }}
20+
@endif
21+
22+
{{ $slot }}
23+
</main>
24+
25+
{{-- Scripts --}}
26+
@filamentScripts
27+
</body>
28+
</html>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<div wire:poll.1s>
2+
<x-slot name="header">
3+
<header>
4+
<div>
5+
<h1 class="text-xl font-bold tracking-tight text-gray-950 sm:text-2xl">Debug Time Zone - {{ config('app.name') }}</h1>
6+
7+
<p class="mt-1 text-sm font-medium">
8+
The purpose of this page is to help debut the current issues around time zones and local time. The table below displays an output of the applications current configuration.
9+
</p>
10+
</div>
11+
</header>
12+
</x-slot>
13+
14+
<div class="space-y-6">
15+
<div class="overflow-hidden bg-white shadow sm:rounded-md">
16+
<div class="p-4 bg-white border-b border-gray-200 sm:px-6">
17+
<h3 class="text-base font-semibold leading-6 text-gray-900">Timezone</h3>
18+
</div>
19+
20+
<ul role="list" class="divide-y divide-gray-200">
21+
<li class="px-4 py-4 sm:px-6">
22+
<p class="text-sm font-medium text-gray-900">PHP time zone</p>
23+
<p class="text-sm text-gray-500 truncate">{{ date_default_timezone_get() }}</p>
24+
</li>
25+
26+
<li class="px-4 py-4 sm:px-6">
27+
<p class="text-sm font-medium text-gray-900">App time zone</p>
28+
<p class="text-sm text-gray-500 truncate">{{ config('app.timezone') }}</p>
29+
</li>
30+
31+
<li class="px-4 py-4 sm:px-6">
32+
<p class="text-sm font-medium text-gray-900">Settings time zone</p>
33+
<p class="text-sm text-gray-500 truncate">{{ $settings['timezone'] }} ({{ \Carbon\Carbon::create($settings['timezone'])->format('P') }})</p>
34+
</li>
35+
</ul>
36+
</div>
37+
38+
<div class="overflow-hidden bg-white shadow sm:rounded-md">
39+
<div class="p-4 bg-white border-b border-gray-200 sm:px-6">
40+
<h3 class="text-base font-semibold leading-6 text-gray-900">Time</h3>
41+
</div>
42+
43+
<ul role="list" class="divide-y divide-gray-200">
44+
<li class="px-4 py-4 sm:px-6">
45+
<p class="text-sm font-medium text-gray-900">UTC time</p>
46+
<p class="text-sm text-gray-500 truncate">{{ \Carbon\Carbon::now() }}</p>
47+
</li>
48+
49+
<li class="px-4 py-4 sm:px-6">
50+
<p class="text-sm font-medium text-gray-900">Local time</p>
51+
<p class="text-sm text-gray-500 truncate">{{ \Carbon\Carbon::now()->timezone($settings['timezone'] ?? 'UTC') }}</p>
52+
</li>
53+
</ul>
54+
</div>
55+
</div>
56+
</div>

routes/debug.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
use App\Livewire\Debug\Timezone as DebugTimezone;
4+
use Illuminate\Support\Facades\Route;
5+
6+
Route::get('/debug/timezone', DebugTimezone::class)
7+
->name('debug.timezone');

routes/web.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
return redirect('/admin/login');
2323
})->name('login');
2424

25+
require __DIR__.'/debug.php';
26+
2527
if (app()->isLocal()) {
2628
require __DIR__.'/test.php';
2729
}

0 commit comments

Comments
 (0)