How can I translate this pseudo code into working js [don\'t worry about where the end date comes from except that it\'s a valid javascript date].
var myEndD
This is what I found:
//First, start with a particular time
var date = new Date();
//Add two hours
var dd = date.setHours(date.getHours() + 2);
//Go back 3 days
var dd = date.setDate(date.getDate() - 3);
//One minute ago...
var dd = date.setMinutes(date.getMinutes() - 1);
//Display the date:
var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var date = new Date(dd);
var day = date.getDate();
var monthIndex = date.getMonth();
var year = date.getFullYear();
var displayDate = monthNames[monthIndex] + ' ' + day + ', ' + year;
alert('Date is now: ' + displayDate);
Sources:
http://www.javascriptcookbook.com/article/Perform-date-manipulations-based-on-adding-or-subtracting-time/
https://stackoverflow.com/a/12798270/1873386