I want to make a function that takes today's date and add more days. For example, if todays' date is 10/09/20 and I add 5 days I want to return 15/09/20.
I want to format the result as such:
15 Sep
I've created the following function:
function calcDate(days){
var curDate = new Date();
var estDate = curDate.setDate(curDate.getDate() + days);
return estDate.getDate() + ' ' + estDate.getMonth();
}
However, I get the error estDate.getDate() is not a function
.
If I just return estDate
I also get an unformatted number, eg: 1608685587862
I've tried several approaches from Google and Stack Overflow but none work.
Would anyone know what I am to do?