🤖transistor🤖
🤖transistor🤖
FFilament
Created by 🤖transistor🤖 on 6/6/2024 in #❓┊help
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!
1 replies
FFilament
Created by 🤖transistor🤖 on 2/26/2024 in #❓┊help
How the get the option label from a select
So, I've got a Select and I want to fill a TextInput with the value selected. Not the value of the option, but the label. Say, I've got
<select>
<option value="1">something</option>
</select>
<select>
<option value="1">something</option>
</select>
When the user selects something I want to fill a TextInput with something My Select looks like this:
Forms\Components\Select::make('exchange_rate_id')
->relationship('exchange_rate', 'rate')
->searchable()
->preload()
->live()
->reactive()
Forms\Components\Select::make('exchange_rate_id')
->relationship('exchange_rate', 'rate')
->searchable()
->preload()
->live()
->reactive()
and my TextInput:
Forms\Components\TextInput::make('exchange_rate')
->numeric()
->key('exchangeRate')
Forms\Components\TextInput::make('exchange_rate')
->numeric()
->key('exchangeRate')
I've tried using afterStateUpdated injecting the state, the component, Get, Set, but the only thing I can get is the option value (1 in this example). How can I get something from the selected option? Thanks in advance.
5 replies