validatorjs
validatorjs copied to clipboard
Adjusted date rule handling
This PR adjusts the handling of the date rules (after
, after_or_equal
, before
, before_or_equal
) to also accept a date string as an argument instead of only allowing attribute names to be passed.
[ ] Documentation update [x] Bug fix [x] New feature [ ] Other, please explain:
The value passed into the rule will be checked if it is a valid date string. If so, the date value will directly be used for comparison against the attribute of the model for which the rule is defined.
If the rule value is not a valid date string, it will be assumed to be a reference to an attribute of the model and comparison will be made against the value of this attribute.
This addition brings the library more in line on how the date rules work in the Laravel Framework (after rule)
Resolves #210 Resolves #279
Would absolutely love to get this pulled in :)
I would love to have this merged