Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

618
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda