Closed spencerrlongg closed 1 year ago
Happy to bring this in - would you mind adding tests to confirm the behaviour?
Sure thing! added to the PR. Quick explanation of what I did here:
created_at
as is because that's some Laravel stuff, and doesn't seem to change with custom casting regular_datetime
to test a standard datetime
castcustom_date
to test a custom formatted datetime cast (which is what the PR is originally for)I removed the method at the bottom as that seemed to allow any kind of date or datetime to pass no matter what.
What I'm left with is tests that pass with the new check:
And fail without the new check:
Beautiful - thanks for considering all those options. I'll tag a new release shortly.
Thanks so much for this package, we use it pretty extensively and are glad it exists.
This is just a small PR to account for
custom_date
validation.When using a custom date cast like
date:Y-m-d
custom date validationcustom_date:Y-m-d
fails because the default returned isY-m-d H:i:s
. In Laravel 8 a new conern was added:isDateCastableWithCustomFormat()
- adding this to thegetModelAttributes()
date check resolves the issue and I haven't been able to find any side effects.Let me know if you have any questions and again thanks for the package.