We need to increment the date by adding a required number of days (like
2) using the
Here is an example, that increments the current date by 1 day:
const current = new Date(); // it adds 1 day to the current date current.setDate(current.getDate() + 1); console.log(current.toDateString()); /* If today's date is "Thu Sep 03 2020" then it returns tomorrow date is "Fri Sep 04 2020" */
Even if today is the last day of a month like
setDate()method sets the day of the month to a Date object.
getDate()method gets the current day of the month (from 1 - 31).