Date.getDay() javascript returns wrong day
use .getDate
instead of .getDay
.
The value returned by getDay is an integer corresponding to the day of the week: 0 for Sunday, 1 for Monday, 2 for Tuesday, and so on.
getDay()
returns the day of the week. You can however use the getDate()
method.
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getDay