Published
- 1 min read
js previous day
The solution for this is noted below
js previous day
Solution
function previousDay(year, month, day) {
let date = new Date(year, month - 1, day - 1)
console.log(`${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`)
}
Try other methods by searching on the site. That is if this doesn’t work