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

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

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 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