Anthaas
Nullable dates in spatie/laravel-settings
Ahhh, so the prop needs to be a string for that. Again - slightly at odds with the underlying package, but I get why. Wondering what the best approach is. Tempted to suggest the dehydrate method, because at least when you access the settings class at some other point the property is correctly typed.
17 replies
Nullable dates in spatie/laravel-settings
Interesting. That's done it. I completely understand why that is the case - wonder if this could somehow be abstracted away with some sort of sensible default behaviour for the users. The underlying library suggests that this isn't necessary, so I guess its the filament package that needs this handling.
Cheers!
17 replies
Nullable dates in spatie/laravel-settings
@awcodes Sorry for the delay. The duplicate property name was poor copy/paste on my part to show a minimal example.
I have modified the
fill
function in laravel-settings/src/Settings
to catch the TypeError
as follows:
The value I get out is when selecting the 24th Jan 2024 at midnight is 2024-01-24 00:00
. Appending the seconds(false)
call with ->format('Y-m-d H:i:s')
results in a full Y-m-d H:i:s
format: 2024-01-24 00:00:00
. I continue to get the same TypeError thrown.17 replies