Bradford1802
Dates don't increment correctly
put a work around in place and it works. Strangely this only occurs for dates in Sep and Oct for years between 1994 - 2024.
function addDay(date, days) {
const newDate = new Date(date)
newDate.setDate(newDate.getDate() + days)
const checkDate = newDate.toISOString().substring(0, 10)
if (checkDate === date) {
newDate.setDate(newDate.getDate() + days + 1)
return newDate.toISOString().substring(0, 10)
} else {
return newDate.toISOString().substring(0, 10)
}
}
3 replies