In one of the projects I decided to make additional UX features for quick selection of dates in the interface. On the side of the calendar there are buttons: select 3 days, 7 days and 30 days.
Here I share with you a trick on how to quickly add any number of days to the current date:
const nextWeek = new Date() nextWeek.setDate(new Date().getDate() + 7) console.log(nextWeek)
.setDate() function understands the context perfectly, and if the number of days selected exceeds the current month, it automatically changes it.