I have a date that I'm grabbing from Livecycle input form version and I want to perform some calculation. I want to add one year to that date but subtract a day from it. For example, if my date is 7/1/2018 then my future date should be 6/30/2019
I have function written that will add a year but I do not know how I'd subtract a day from it.
var currentDate = mydate.rawValue;
function AddYearToDate(currentDate)
{
if (currentDate == null)
{
return null;
}
var futureDate = currentDate.toString();
if (futureDate.length >= 10)
{
var year = futureDate.slice(0, 4);
return futureDate.replace(year, (parseInt(year)+1).toString());
}
else
{
return null;
}
}