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

435
Vistas
Yup. How to change error message text date

How to change message text for date field:

date must be a date type, but the final value was: Invalid Date

Now scheema looks like this:

let scheema= yup.object().shape({
        date: yup.date()
          .min(MIN_DATE, `Дата не может быть раньше ${MIN_DATE?.toLocaleDateString('ru')}`)
          .max(MAX_DATE, `Дата не может быть позже ${MAX_DATE?.toLocaleDateString('ru')}`)
          .required('Обязательное поле'),
        reason: yup.string().required('Обязательное поле'),
        comment: yup.string().max(4000, 'Превышено количество символов'),
    });

error is:

{
    "date": "date must be a `date` type, but the final value was: `Invalid Date`."
}

I need to change this text

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You could use Schema.typeError as follows:

date: yup.date()
        .typeError('Expected a value of type ${type} but got: ${value}') // ex: Expected a value of type date but got: Invalid Date
        .min(MIN_DATE, `Дата не может быть раньше ${MIN_DATE?.toLocaleDateString('ru')}`)
        .max(MAX_DATE, `Дата не может быть позже ${MAX_DATE?.toLocaleDateString('ru')}`)
        .required('Обязательное поле'),
reason: yup.string().required('Обязательное поле'),
comment: yup.string().max(4000, 'Превышено количество символов'),
about 4 years ago · Santiago Trujillo Denunciar
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