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

410
Vistas
How can I convert my date and time into an acceptable format for React Big Calendar

I am taking date, start time and end time of an event from the database, all of which are stored as strings in these format: eventDate: "2022-02-21", startTime: "20:30", endTime: "22:30" respectively. I need to pass 2022-02-21 8:30 PM as the start time and 2022-02-21 10:30 PM as the end time. From the docs that I read, I believe I have to have them in the array list of event objects as:

new Date(2022, 2, 21, 20, 30, 0) and new Date(2022, 2, 21, 22, 30, 0). These values are dynamic, so I won't manually be able to change them. What are some ways I can manipulate the values of date, startTime and endTime to be able to pass it to the calendar?

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

0

const s = new Date(2022, 2, 21, 20, 30, 0), e = new Date(2022, 2, 21, 22, 30, 0)

const eventDate = `${s.getFullYear()}-${s.getMonth().toString().padStart(2, `0`)}-${s.getDate().toString().padStart(2, `0`)}`

const startTime = `${s.getHours().toString().padStart(2, `0`)}:${s.getMinutes().toString().padStart(2, `0`)}`

const endTime = `${e.getHours().toString().padStart(2, `0`)}:${e.getMinutes().toString().padStart(2, `0`)}`

console.log(`eventDate:`, eventDate, `startTime:`, startTime, `endTime:`, endTime)

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