You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My Panel is scoped to an event, where everyone can have a different timezone, therefore I have created a Middleware that sets the Timezone globally. However, I get unexpected behavior and I'm unsure if this is a misunderstanding on my side or an actual bug that I should report.
My config/app.phptimezone is set to UTC
'timezone' => 'UTC',
My Middleware:
if (session('selected_event_id')) {
$event = Event::find(session('selected_event_id'));
if ($event && $event->timezone) {
$timezone = $event->timezone;
if (in_array($timezone, \DateTimeZone::listIdentifiers(), true)) {
FilamentTimezone::set($timezone);
} else {
Log::warning("Invalid timezone value for event {$event->id}: {$timezone}");
}
}
}
In my Panel I added the middleware in the correct place (I believe):
For Table Columns and Infolist, the timezone value is ignored completely, I have to manually add timezone for it to convert my UTC dates to the timezone eg.
TextColumn::make('time')
->label('Time')
->timezone($timezone) // here
->time("H:i")
->sortable()
->toggleable(),
Based on my understanding of the documentation here, it should not be neccessary.
In Forms, it is picked up correctly, displaying the time in the correct timezone, however when I change it (eg. to 05:00, it stores in the database as 05:00, and not as UTC. If I refresh the page, then the date displayes incorrectly because it calculates the date to the Timezone. Happening with both the native and not native time pickers. This is obviously very confusing for users
This also contradicts what is set in the documentation here by my understanding.
I feel like I'm missing something here but happy to open a bug report, if I understood and implemented it correctly otherwise.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Package
Panel builder
Package Version
v4.2.2
How can we help you?
My Panel is scoped to an event, where everyone can have a different timezone, therefore I have created a Middleware that sets the Timezone globally. However, I get unexpected behavior and I'm unsure if this is a misunderstanding on my side or an actual bug that I should report.
My
config/app.phptimezone is set to UTCMy Middleware:
In my Panel I added the middleware in the correct place (I believe):
For Table Columns and Infolist, the timezone value is ignored completely, I have to manually add timezone for it to convert my UTC dates to the timezone eg.
Based on my understanding of the documentation here, it should not be neccessary.
In Forms, it is picked up correctly, displaying the time in the correct timezone, however when I change it (eg. to 05:00, it stores in the database as 05:00, and not as UTC. If I refresh the page, then the date displayes incorrectly because it calculates the date to the Timezone. Happening with both the native and not native time pickers. This is obviously very confusing for users
This also contradicts what is set in the documentation here by my understanding.
I feel like I'm missing something here but happy to open a bug report, if I understood and implemented it correctly otherwise.
Beta Was this translation helpful? Give feedback.
All reactions