Datepicker return time how to return date only

Hi i have a filament datepicker input but it also return time with but i only want the date and not time is the a way to do that i dont want to use the native date picker i like the javascript version and due to is return time so i does not let me select the current date when i do i get a error because the time is wrong but there is no time selector
DatePicker::make('start_date')
->time(false)
->prefixIcon('fal-calendar-arrow-up')
->minDate(Carbon::now())
->native(false)
->required(),
DatePicker::make('start_date')
->time(false)
->prefixIcon('fal-calendar-arrow-up')
->minDate(Carbon::now())
->native(false)
->required(),
No description
15 Replies
eliekicode
eliekicode4w ago
Try to replace Carbon::now() by Carbon::now()->toDateString() If you want the current date to be selectable, then you can use Carbon::now()->subDay()->toDateString() as minDate
sohail
sohailOP2w ago
there is only one carbon::now that on min date do you want me to change that one that does not do anything sorry for the late reply
idk
idk2w ago
Maybe use Carbon::now()->format() ?
sohail
sohailOP2w ago
right but where in the min date you mean
idk
idk2w ago
in minDate yes minDate(Carbon::now()->format('Y-m-d')) try it dont know if it will work
sohail
sohailOP2w ago
but it still return the date with time in only what the date not the time
idk
idk2w ago
No it doesnt, if you add the format the output will be 2025-01-09
sohail
sohailOP2w ago
what i dont understand what you mean
idk
idk2w ago
Oh, you mean change the message of the error?
sohail
sohailOP2w ago
no i want the date picker to only return date but it also return time with do so now everyvery is am using the date to formate or validate other input i have to do Carbon::parse($get('start_date'))->formate('Y-m-d') and i would prefer if i didnt had to do that
toeknee
toeknee2w ago
What is your model casting it to?
sohail
sohailOP2w ago
datetimestring
toeknee
toeknee2w ago
There is your problem it should be date not datetime
sohail
sohailOP2w ago
well i need the time but i let the user select the separately
toeknee
toeknee2w ago
So you can't expect the date to return false in the way you are because the model is saying datetime but you are saying date. It's always going to be messy. Either split out the picker and have one column date and one time, or use date time.

Did you find this page helpful?