Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Marijn's avatar

HTML5 date input with Carbon

Hi! Simple question but for some reason I cannot really get a lot of answers online. I want to connect an HTML5 date input to some variable in the php component that is of the type Carbon. Is this even possible? Trying it myself the variable on the backend becomes a string "2022-02-20" after one round trip. I though livewire parsed this string and automatically made a carbon instance out of it? Am I mistaken? Is the only option to use some javascript date picker?

<?php

namespace App\Http\Livewire;

use Livewire\Component;

class DatePicker extends Component
{
    public $date;

    public function mount()
    {
        $this->date = now();
    }

    public function render()
    {
        return view('livewire.date-picker');
    }
}
<div>
    <input type="date" wire:model="date">
</div>
0 likes
4 replies

Please or to participate in this conversation.