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

309
Vistas
acceptRegex in DatePicker MUI library not working as intended

I am trying to block invalid date input by using the acceptRegex property in Datepicker but couldn't get it applied. I don't want the user to enter an invalid date like 3022-56-45 by keyboard input.I should be allowing the numbers which forms valid date only. Here is my current implementation.

<LocalizationProvider dateAdapter={AdapterDateFns}>
              <DesktopDatePicker
                label="Date of Birth"
                inputFormat="yyyy-MM-dd"
                acceptRegex="/^d{4}-d{2}-d{2}$/"
                mask={"____-__-__"}
                minDate="1900-01-01"
                value={dateOfBirth ? parseISO(dateOfBirth) : null}
                onChange={(val) => {
                  setDateOfBirth(moment(val).utc().format("YYYY-MM-DD"));
                }}
                renderInput={(params) => (
                  <TextField fullWidth sx={{ pr: 3 }} {...params} />
                )}
              />
            </LocalizationProvider>
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