Avatar

Level 10

Hi,

Are you using Adobe LiveCycle Designer or Acrobat to edit your form, that is it an XFA Form or a AcroForm.  This code would suggest you are working on an AcroForm, in which case you would be better off in a different forum, maybe this one PDF Forms

If you are using Designer then try this code in the calculate event of the calculate date field.

var Days = { Sunday : 0, Monday : 1, Tuesday : 2, Wednesday : 3, Thursday : 4, Friday : 5, Saturday : 6 };

function addWorkingDays(startDate, days)

{

    var weekend = [Days.Saturday, Days.Sunday];

    for (var currentDate = startDate; days > 0; currentDate.setDate(currentDate.getDate()+1))

    {

        if (weekend.indexOf(currentDate.getDay()) < 0)

        {

            days--;

        }

    }

    return currentDate;

}

if (!OriginalDate2.isNull && !DaysAdded10.isNull)

{

  var sDate = OriginalDate2.formattedValue;

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

  var calculateDate = addWorkingDays(d, DaysAdded10.rawValue);

  isNaN(calculateDate) ? null : util.printd("YYYY-MM-DD", calculateDate, true);

}

This document explains the differences http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/AcroJS_DesignerJS.pdf

Regards

Bruce