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

185
Views
Timezone specific date error in luxon javascript

I am using luxon for generating timezone specific dates.

Here are the outputs I am getting

startStr 2021-11-14 12:00:00 am
startTimeObj 2021-11-13T18:00:00.000Z
endStr 2021-11-14 08:00:00 am
endTimeObj 2021-11-14T14:00:00.000Z

Here is my code to convert the dates

return DateTime.fromFormat(startStr, 'yyyy-MM-dd tt', {zone: 'Asia/Dhaka', setZone: true}).toJSDate();

for startStr it is working properly. As the timezone provided is 6hours ahead it is showing 18:00:00.

But for endStr it is giving wrong output. I am guessing it is ignoring am/pm. Because the output should have been T02:00:00 but instead its showing T14:00

interestingly, it works perfectly in my local mac device. Getting wrong values in the server

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