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

248
Vistas
how to disable future time in material-ui KeyboardDateTimePicker in reactjs

I'm using Material UI KeyboardDateTimePicker and by using disabledFuture I was able to disable future date but I want to disable future time as well. any solution would be appreciated

import { KeyboardDateTimePicker } from "@material-ui/pickers";
 <KeyboardDateTimePicker
            color="primary"
            disableFuture
            format="yyyy-MM-dd hh:mm a"
            label={intl.formatMessage({ id: "end" })}
            margin="normal"
            onChange={(x) => onChange({ from, to: x?.toJSDate() ?? null })} 
            value={to}
            variant="inline"
            maxDate={new Date()}
          />

Note - i don't want to update library

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can validate the value yourself by passing down an error prop to the underlying Textfield component, if the dateTime is in the future.

<KeyboardDateTimePicker
  value={to}
  error={dateTimeIsInFuture(to)}

You can then add a custom error message using the helperText prop: react material - ui text field validation : set custom error messages.

about 4 years ago · Juan Pablo Isaza 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