Avatar

Level 2

The code is not working.

Please again see below script, it is working good, but only it not skip all Saturdays and Sunday:

// Custom Calculate script for NewDate field

(function () {

    // Get date entered into the OrigianlDate field

    var sDate = getField("OriginalDate2").valueAsString;

    // Convert string to date

    var d = util.scand("dddd d mmm yyyy", sDate);

    // Get the number of days added, as a number

    var days = getField("DaysAdded10").value;

    // Add days to date

    d.setDate(d.getDate() + days);

    // Populate this field with the result

    if (sDate) {

        event.value = util.printd("dddd d mmm yyyy", d);

    } else {

        event.value = "";

    }

})();