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

124
Views
2022-03-27 +1 day - Bug or my Error in javascript in function toISOString?

After adding +1 day and converting to ISO format, it will not execute correctly on the entry date 2022-03-27.

Isn't it related to daylight saving time?
If I also added the time to the date (2022-03-07 05:00:00), then the date conversion was correct.
But it is better for me to enter only the date.

function fnDp( inDtateIsoFormat ){
  "use strict";
  var d1 = inDtateIsoFormat,
      dp = new Date(d1);
  console.group("Date Bug JS "+d1+" +1 day");
  console.log("dp:\n\t",dp,'\n\t',dp.toISOString().substring(0,10));
  dp.setDate(dp.getDate()+1);
  console.log("dp +1 day:\n\t",dp,'\n\t',dp.toISOString().substring(0,10));
  console.groupEnd();
}

fnDp('2022-03-25');
fnDp('2022-03-27');
fnDp('2022-03-29');

Image console log

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!