TimePicker
Hi Everyone, how I can make TimePicker::make('time') works with 24 hours and not 12 hours system
16 Replies
You can set the PHP display format with
->displayFormat()
. But the default should be H:i
which is 24hI try it still same
@awcodes Hi, you have any idea about this? many thanks
Please read our #✅┊rules and don't tag people!
sorry @Dennis Koch
hi
could you share the full code of that file?
->native(false)
with ->native(false) works but look like this, user can't write inside text field directly wich not a good UX.
Yep. There’s caveats both ways. Native doesn’t allow disabling seconds or using a 24 hour format.
That’s up to the browser at that point.
so there is no way to make input field that accept only
00:00 format ?
Not without a custom input.
Could potentially do it with a TextInput and a mask. Would just need to make sure the state / casting is handled appropriately if your db field is time based.
any example to do that with input and mask? and yes field in my DB is time
Specifically that use case, no. It should be straightforward. https://filamentphp.com/docs/3.x/forms/fields/text-input#input-masking
Might want to add some validation around it too so you don’t get things like 32:99
Or a negative time.
thank you so much I will try that
Might even make a good plugin if you get it all working. 🙂