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

139
Views
getDay() function of "date-fns" gives different results for the same date

Given the following 2 dates in ISO format:

2022-08-28T01:00:00.000Z
2022-08-28T23:00:00.000Z

getDay() returns 0 for the first one, and 1 for the second one.

Note that it's the same date, and only time is changed.

I am assuming it returns the result after converting it to local time. Because of that behavior, my logic has some side-effects.

Is there a way to get the result without conversion to local time?

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

0

The getDay documentation clearly states it returns results in local time. You need the getUTCDay function.

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!