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

317
Vistas
Yup validation for two fields, when one field changes make other field null

there I'm trying to make this kind of a function, Where if the first field changes value the second field should be null

I have this

            start: Yup.date()
                .max(new Date(), 'startDateCannotBeHigher')
                .required('pleaseWriteStartDate'),
            end: Yup.date().when(start, {
                is: (start) => start,
                then: Yup.date()
                    .when(
                        'start',
                        (start, schema) =>
                            start &&
                            schema.min(
                                new Date(new Date(start).setFullYear(new Date(start).getFullYear() + 1)),
                                'endDateCannotBeSameAsStartDate'
                            )
                    )
                    .required('pleaseWriteEndDate'),
            }),

So when the start field is changed, I want the end to be null.

Thanks a lot

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