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

76
Views
Weird Date object creation

This my index.js file:

console.log(
    "new Date(2022, 2, 23, 0, 0, 0, 0)",
    new Date(2022, 2, 23, 0, 0, 0, 0)
);
console.log(
    "new Date(2022, 4, 16, 0, 0, 0, 0)",
    new Date(2022, 4, 16, 0, 0, 0, 0)
);

And the output I'm getting is:

new Date(2022, 2, 23, 0, 0, 0, 0) 2022-03-23T00:00:00.000Z
new Date(2022, 4, 16, 0, 0, 0, 0) 2022-05-15T23:00:00.000Z

I'm expecting to see the ...05-16T00... in the second, but somehow that is not that case.

I'm running node.js version 16.14.2, I tried to upgrade to 16.15.0. Also I tried 17.9.0 and 18.2.0

When I tried to put the code above to the browser or tried the https://codesandbox.io/, I've got what I'm expecting.

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!