I am using the express validator for the validation in nodejs. I need to show error message if the user select date of birth greater than date of dead.
check('dob').notEmpty().bail().withMessage('Please enter the DOB').toDate().bail(); Currently I am using the above code for dob error but not sure how to add the another check in it.
This is a way to achieve what you are asking. Be aware that if dob fails validation, dod still tries to validate.