© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
4 replies
valentin_morice

DatePicker value if DB field is null

I have a DatePicker component in a DonorsResource form, that lets you chose a birthdate for a new donor.
However, this field is optional. When the column is null, and you chose to edit a donor, the DatePicker has the date 01/01/1970 pre-filled.
Is there any way, in this case, to assign it the default "dd/mm/yyyy" that's present in the "New Donor" form?
Solution
You are passing a null value which is trying to be formatted with the datepicker, which is in the past. Try adding ->nullable() to it and failing that, ->formatStateUsing(fn($state) => $state ? $state : '')
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Beginner form question - Field value is 'null'
FilamentFFilament / ❓┊help
2y ago
Value of field ins null
FilamentFFilament / ❓┊help
2y ago
formatStateUsing not called if value is null
FilamentFFilament / ❓┊help
3y ago
IconEntry not showing icon if value is null
FilamentFFilament / ❓┊help
3y ago