The incoming content is formatted as <OrderDate>3/20/2018 4:13:17 PM</OrderDate>
I would like to add 3 days to the Order Date to get a Due Date in the Switch Script below.


I keep getting errors that it is expecting a different date format like YYYY-MMM-DD
//*** Due Date ***
var due = getValue(contents, "OrderDate");
due = due.split(" ")[0];
contents = setValue(contents, "DueDate", due);
if (due != undefined) {
due = new Date( Date.parse(due) );
} else {
var order = new Date( Date.parse( getValue(contents,"OrderDate") ) );
switch (getValue(contents, "Handling")) {
case "N" :
order.setDate(order.getDate() + 2); //two days from order
//job.log(2, "two days from order");
}
due = order;
}
contents = setValue(contents, "OrderDate", due.toString().left(10));