Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

412
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!