IN laravel 10 app I use Date field, like:
Date::make(__('Published at'), 'published_at')
->hideFromIndex()
->canSee(function ($request) use ($status) {
return $status === ProductStatusEnum::ACTIVE;
})
->sortable(),
and it shows date 05/13/2024
format
I did not find how can I change format of date, like 5 June, 2021
or 05-13-2024
?
Not familiar with nova myself, but yes format was removed in v4 Nova - Date Time Fields
Using a formatted Text
field appears to be the easiest workaround. Personally I'd avoid making this change unless absolutely necessary.
But when it is
absolutely necessary
, which code/methods do you use ?
I define Date field as :
Date::make(__('Published at'), 'published_at')
->displayUsing(fn($value) => $value ? DateConv::getFormattedDateTime($value) : '--')
->sortable(),
where DateConv::getFormattedDateTime apply format j F, Y g:i A
and label in index/view pages
looks like 3 July, 2024 11:21 AM
but in details editor 07/23/2024
that is very inconvinient. In my country more used format is 'yyyy-mm-dd'.
If there is a way to apply this format ?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community