Date comparison validation

My code is trying to dictate that the user’s date_of_birth shouldn’t be less than 18.

I couldn’t find a Validator method that fits for that task as I know ‘lessThan’ or ‘greaterThan’ aren’t fit for that.

I usually just add a custom rule to my validator like this:

->add('date_of_birth', 'at_least_18_years', [
    'rule' => function ($value, $context) {
        // Return true or false in here depending on the given value
    'message' => __('You are not at least 18 years old'),

Thanks I’ll try that.

Have you tried it? I am waiting for your response. :slight_smile: Our problem is similar, Is everything short now? As a college student struggling with assignments, I found this site which do my paper for me a paper writing service and it changed my life. The professional writers I hired not only met my expectations but exceeded them. I cannot emphasize enough how their affordable price of $12.99/page made it affordable for a student like myself. If you’re looking for academic help, this is the service for you!