Table text column date confusion
Hey everyone.
I don't get it. I have my Users table with the column
email_verfied_at
of type timestamptz
and the date is saved in UTC.
My app timezone config is set to UTC.
An example date is 2024-06-05 11:19:49-06
in UTC.
In a table, when I make a simple text column, the date is displayed in UTC as expected.
Tables\Columns\TextColumn::make('email_verified_at'),
What I'm looking for is 2024-06-05 13:19:49
which is the correct date/time for Madrid.
If I add ->timezone('Europe/Madrid')
to the text column nothing happens, still the UTC date.
If I add ->dateTime()
the date is now: Jun 5, 2024 17:19:49
which is 4 hours ahead of UTC, not 2 for Madrid, why?
If I add ->timezone('Europe/Madrid')
after dateTime, the date is now: Jun 5, 2024 19:19:49
, now 4 hours ahead of Madrid, why?
I have to keep the timezone dynamic, because it would depend on the timezone the user has selected, not a problem, I know I can get it via auth()->user()->timezone
I also know that I can mutate the date in the model, but this should work, right?
Any pointers? Thanks!0 Replies