Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

617
Views
How to validate the difference between two dates using Yup in React

I have two inputs of type date (dateFrom and dateUntil) and I want to do the following validation: The difference between these two dates must be max 11 months(dateUntil - dateFrom <= 11 (months)).

I tried this:

validationSchema={() =>
            Yup.lazy((values) => {
                return Yup.object().shape({
                    importedDateUntil: Yup.date().Yup.ref('importedDateUntil').diff(Yup.ref('importedDateFrom'), "months") <= 11
                });
            })
        }

But it's not working like this. Please let me know if you have any suggestions/solutions.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!