{{--
Native date field (add-project.html ~line 396 — the wireframe uses the
browser's own picker, so no datepicker plugin is wired up here).
Same props as , minus `type`. The value — a Carbon instance,
a DateTime, or a string in almost any format — is normalised to the Y-m-d
that `` requires; anything unparseable renders as empty
rather than throwing.
This does not delegate to because old input has to be
normalised too, and input resolves old() itself.
---
spatie/laravel-html variant. html()->date() is deliberately not used: it
resolves old input and formats the value itself, which would duplicate (and
disagree with) form_old() / form_date_value().
--}}
@props([
'name',
'label' => null,
'value' => null,
'required' => false,
'groupClass' => null,
])
@php
$fieldId = $attributes->get('id') ?? form_field_id($name);
$error = form_error_message($name);
$resolved = form_date_value(form_old($name, $value));
$control = html()->input('date')
->class('form-control')
->addClassIf($error !== null, 'is-invalid')
->id($fieldId)
->name($name)
->attributeIfNotNull($resolved, 'value', $resolved)
->attributeIf((bool) $required, 'required')
->attributeIf($error !== null, 'aria-invalid', 'true')
->attributeIf($error !== null, 'aria-describedby', form_field_id($name).'_error');
$passthrough = form_passthrough_attributes($attributes);
$control = $control->attributes($passthrough);
@endphp
{!! $control->render() !!}