From 691e51ae7bcc6f48bc1098232cff68e35d94ab7a Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Fri, 29 Nov 2024 11:03:44 +1100 Subject: [PATCH] ensure run at is always returned to the front end in UTC --- src/Livewire/Concerns/RemembersQueries.php | 2 +- tests/Feature/Livewire/RemembersQueriesTest.php | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 tests/Feature/Livewire/RemembersQueriesTest.php diff --git a/src/Livewire/Concerns/RemembersQueries.php b/src/Livewire/Concerns/RemembersQueries.php index 90a2e7bb..c8df172d 100644 --- a/src/Livewire/Concerns/RemembersQueries.php +++ b/src/Livewire/Concerns/RemembersQueries.php @@ -20,7 +20,7 @@ trait RemembersQueries public function remember(callable $query, string $key = '', DateTimeInterface|DateInterval|Closure|int|null $ttl = 5): array { return App::make(CacheStoreResolver::class)->store()->remember('laravel:pulse:'.static::class.':'.$key.':'.$this->period, $ttl, function () use ($query) { - $start = CarbonImmutable::now()->toDateTimeString(); + $start = CarbonImmutable::now('UTC')->toDateTimeString(); [$value, $duration] = Benchmark::value(fn () => $query($this->periodAsInterval())); diff --git a/tests/Feature/Livewire/RemembersQueriesTest.php b/tests/Feature/Livewire/RemembersQueriesTest.php new file mode 100644 index 00000000..ddbb7e58 --- /dev/null +++ b/tests/Feature/Livewire/RemembersQueriesTest.php @@ -0,0 +1,16 @@ + false, 'disableHighlighting' => true]) + ->assertSeeHtml(<<<'HTML' + Run at: ${formatDate('2000-01-01 13:00:00')} + HTML); +}); +