Closed flatcapco closed 3 weeks ago
Have you tried “date time:Y-m-d H:i” ?
Have you tried “date time:Y-m-d H:i” ?
I was just about to reply - looks like datetime:Y-m-d works as a cast, but I don't really want to modify the main cast if possible - is there another way to format it before passing it into the mary component? or should I just create a separate associated field and do the formatting there?
$this->start_date = $this->season->start_datetime->format('Y-m-d');
$this->end_date = $this->season->end_datetime->format('Y-m-d');
}
public function save(): void
{
$data = $this->validate();
$this->season->update([
'name' => $data['name'],
'start_datetime' => Carbon::parse($data['start_date'])->startOfDay(),
'end_datetime' => Carbon::parse($data['end_date'])->endOfDay(),
]);
Do you think this is a clean enough way to handle this?
It really depends of your use case, and it is out of the scope of this package. Glad it works for you ;)
maryUI version
latest
daisyUI version
latest
Livewire version
latest
What browsers are affected?
Chrome
What happened?
I'm trying to create an edit page following the flow example, I've been getting on really well but come across a snag using datetime, it doesn't hydrate the data so the field shows empty. It updates just fine if I select a value. The create screen also works as expected.
In the edit blade file:
In my model:
Is there a specific cast its expecting on this view?