LaravelCollective / html

HTML and Form Builders for the Laravel Framework
MIT License
4k stars 806 forks source link

Form date field doesn't support CarbonImmutable #703

Open mxaGianluca opened 2 years ago

mxaGianluca commented 2 years ago

When passing an immutable Carbon object into the Form::date field, it will try and validate the input by checking if it's an instance of DateTime which doesn't pass.

https://github.com/LaravelCollective/html/blob/ae15b9c4bf918ec3a78f092b8555551dd693fde3/src/FormBuilder.php#L434

This could be fixed by checking if the value implements DateTimeInterface, then it would support both.