Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

438
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda