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

184
Views
Getting wrong date when using moment

I am getting a date time from an api 2022-04-01T00:00:00.000Z, and I am using moment to get day and date from the api response in following way:

console.log(moment(resp.data.shift_date).format('ddd, MMM Do, YYYY'));

OUTPUT: Thu, Mar 31st, 2022. But the date which I am getting from api is of 1st april, 2022. I am not sure what I am doing wrong

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

try moment.utc(dt).format('ddd, MMM Do, YYYY')

dt is your date coming from API.

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!