validatorjs icon indicating copy to clipboard operation
validatorjs copied to clipboard

Adjusted date rule handling

Open LuckyLukas98 opened this issue 2 years ago • 2 comments

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

LuckyLukas98 avatar May 30 '22 17:05 LuckyLukas98

Would absolutely love to get this pulled in :)

npw1982 avatar Dec 06 '22 17:12 npw1982

I would love to have this merged

franciscomemoli avatar May 02 '24 18:05 franciscomemoli