To create a new date instance you will use
var date = new Date();. This creates a date object.
From that object, you can get the current day, month, and year among other date-related data.
To get the current day for example this will be:
01: var date = new Date(); 02: console.log("output current day: ", date.getDate()); //output current day: 16
We can increase the day by simply adding a number to the
getDate method to get the next day.
01: var date = new Date(); 02: console.log("output current day: ", date.getDate() +1); //output current day: 17
Finally, to update the date object with increased days we use the
01: var date = new Date(); 02: var newDate = date.getDate() + 1; 03: date.setDate(newDate); 04: console.log(date); //Mon Oct 17 2022 04:14:16 GMT+0000 (Greenwich Mean Time)