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

174
Vistas
setting dynamic value in date-time-local in react

I have one get and post APIs which involve date-time-local input. First I sent the date-time values to the server via post API and then get the same values from the get method.

the same date-time value with the same format I received from the server but when I set it as the input date-time-local value, it was not visible.

My input type

<input type="datetime-local" name="year" class="form-control" value={this.state.dateTime} />
//value coming from the server is in the format of 2021-11-11T16:27:00Z

I faced this error in the console

The specified value "2021-11-11T16:27:00Z" does not conform to the required format.  The format is "yyyy-MM-ddThh:mm" followed by optional ":ss" or ":ss.SSS".

I also tried to convert server string values to the date object but it did not work.

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

0

Try passing this.state.dateTime.toLocalString() into your input. This looks like it would generate the format it needs.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString

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