A JSFiddle is worth 1000 words: https://jsfiddle.net/cnuss/6731pakm/1/
What I'm seeing is that date.getDay()
is returning the wrong value.
function getDay(date: Date) {
return "The current day is: " + date.getDay();
}
document.querySelector("#app").innerHTML = getDay(new Date('2020-04-06'));
The return value is The current day is: 0
2020-04-06
is most certainly a Monday. So it should return 1?
What's going on?