I'm feeling a bit overwhelmed by the code below.
var forDt = new Date("2017-07-31"+ "T09:00:00.000");
var workDt = new Date();
workDt.setDate(forDt.getDate() - 1);
date_prev = workDt.toISOString().slice(0, 10);
Today is August 1st. I clicked a Prev
button twice and datePrev
changed from July 31
to August 30.
I need some assistance in figuring out what went wrong in my code. It seems like setDate()
is setting 31-1=30
without updating the month. Can someone help me fix this issue?
Thanks in advance, everyone! =)