validation
validation copied to clipboard
Update Date.php
trafficstars
In a recent project, we've experienced issues using the Date rule filter due to a depracated warning caused by the Date.php rule.
Deprecated... date_create_from_format(): Passing null to parameter #2 ($datetime) of type string is deprecated in .../vendor/rakit/validation/src/Rules/Date.php
Proposed fix: Default $datetime argument ($value) to an empty string over null to prevent a deprecation warning. I am unsure whether this approach is up to the standards of this code base but it was a viable fix to our problem.
Currently we circumwent this by using a custom validator for dates (affectionally called Date2) that we use instead of the default date rule.