Set up date of 4th working day from the current date as a parameter in the script.
// Get Now
var theDate = new Date();
logger.debug("The date is: "+theDate);
// Slice up date (Month runs 0-11 in Java)
logger.debug("The Year: "+theDate.getFullYear());
logger.debug("The Month minus 1: "+theDate.getMonth());
logger.debug("The Day: "+theDate.getDate());
theDate.setMonth(theDate.getMonth()+1);
logger.debug("The date + 1 month is: "+theDate);
var TidyDate = theDate.getDate() +"/"+ (parseInt(theDate.getMonth())+1) +"/"+ theDate.getFullYear();
logger.debug("Date to compare is: "+TidyDate);
var theHolidayArray = new Array("13/6/2019","14/6/2019","25/12/2019");
var aDayInMillis = 24*60*60*1000;
for (count=0;count < theHolidayArray.length;count++)
{
logger.debug("Tidy("+TidyDate+") == Holiday["+count+"]: "+ theHolidayArray[count]);
if(TidyDate == theHolidayArray[count])
{
theDate = new Date(Math.abs(theDate.getTime()+(aDayInMillis*1)));
logger.debug("...add a day because its a holiday");
TidyDate = theDate.getDate() +"/"+ (parseInt(theDate.getMonth())+1) +"/"+ theDate.getFullYear();
}
}
var theDateArray = theDate.toString().split(" ");
logger.debug("Day Part is: "+theDateArray[0]);
switch(theDateArray[0])
{
case "Sat" : adjustedDate = new Date(Math.abs(theDate.getTime()+(aDayInMillis*2)));break; //add two days
case "Sun" : adjustedDate = new Date(Math.abs(theDate.getTime()+(aDayInMillis*1)));break; //add one day
default : adjustedDate = theDate; //leave as is
}
logger.debug("The date + 1 month (excluding weekends) is: "+adjustedDate);
var format;
var numDigitsDay = (adjustedDate.getDate().toString()).length;
var numDigitsMonth = ((parseInt(adjustedDate.getMonth())+1).toString()).length;
logger.debug("d=" + numDigitsDay);
logger.debug("m=" + numDigitsMonth);
switch(true)
{
case (numDigitsDay == 1 && numDigitsMonth == 1) : format = adjustedDate.getFullYear() +"-0"+ (parseInt(adjustedDate.getMonth())+1) +"-0"+ adjustedDate.getDate();break;
case (numDigitsDay == 1 && numDigitsMonth == 2) : format = adjustedDate.getFullYear() +"-"+ (parseInt(adjustedDate.getMonth())+1) +"-0"+ adjustedDate.getDate();break;
case (numDigitsDay == 2 && numDigitsMonth == 1) : format = adjustedDate.getFullYear() +"-0"+ (parseInt(adjustedDate.getMonth())+1) +"-"+ adjustedDate.getDate();break;
case (numDigitsDay == 2 && numDigitsMonth == 2) : format = adjustedDate.getFullYear() +"-"+ (parseInt(adjustedDate.getMonth())+1) +"-"+ adjustedDate.getDate();break;
}
logger.debug("Formatted Date: " + format);
This can be done using custom java script, I’ve done this in the past to exclude public holidays too