Gets past or future date

getDate(a){
				let date1 = new Date();
				let date2 = new Date(date1);
				date2.setDate(date1.getDate() + a);
				return date2.getFullYear()+"."+(date2.getMonth()+1)+"."+date2.getDate();
			},

7 days after the date of:  

getDate(7)

7 days before the date:  

getDate(-7)

Guess you like

Origin www.cnblogs.com/lezuw/p/11543907.html