Setting default value of Date FormElement

I added a Date FormElement to my form using the following code:

                'type' => Date::class,
                'name' => 'examinationDate',
                'options' => [
                    'label' => 'Prüfungsdatum',
                'attributes' => [
                    'value' => \date('Y-m-d'),

However, the default value is not set on the web page. Am I missing something?

Works as expected:

$form = new Laminas\Form\Form();
        'type'       => Laminas\Form\Element\Date::class,
        'name'       => 'examinationDate',
        'options'    => [
            'label' => 'Prüfungsdatum',
        'attributes' => [
            'value' => \date('Y-m-d'),

$renderer = new Laminas\View\Renderer\PhpRenderer();
    (new Laminas\Form\ConfigProvider())->getViewHelperConfig()

echo $renderer->form($form);


<form action="" method="POST">
        <input type="date" name="examinationDate" value="2024-01-17">


Have you overwritten the element or the view helper somehow? Or do you set data to form with empty values:

$form->setData(['examinationDate' => '']);

Results in:

<input type="date" name="examinationDate" value="">

Found the error: The entity I tested on was beeing edited instead of created and had null as value for this field.

Thank you for the quick reply :slight_smile: