format javascript date and add 365 days

I want to add 365 days to a formatted javascript date.

var today = new Date();
var day = today.getDate();
var month = today.getMonth();
var year = today.getFullYear();
today = year +"-"+ day +"-"+ month;
var duedate = new Date(today);
duedate.setDate(today.getDate() + 365);

Console says that today.getDate() in the last line is not a function. How do I correctly add 365 days to the formatted date? Thank you!

99 thoughts on “format javascript date and add 365 days”

Leave a Comment