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
15 Replies
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
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 replyMaybe use Carbon::now()->format() ?
right but where
in the min date you mean
in minDate
yes
minDate(Carbon::now()->format('Y-m-d'))
try it
dont know if it will work
but it still return the date with time in only what the date not the time
No it doesnt, if you add the format the output will be 2025-01-09
what i dont understand what you mean
Oh, you mean change the message of the error?
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 thatWhat is your model casting it to?
datetimestring
There is your problem
it should be date not datetime
well i need the time but i let the user select the separately
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.