I try use computed field to calculate leave and working days. The error form show as below
script to count the working days
var nDateStart = session.createDateTime(document1.getValue("StartDate")).toJavaDate();
var nDateEnd = session.createDateTime(document1.getValue("EndDate")).toJavaDate();
var syear = @Year(nDateStart)
var smth = @Month(nDateStart)
var sday = @Day(nDateStart)
var startdate = @Date(syear,smth,sday)
var eyear = @Year(nDateEnd)
var emth = @Month(nDateEnd)
var eday = @Day(nDateEnd)
var enddate = @Date(eyear,emth,eday)
var weekends = "1:7"; //assuming your weekend is Saturday and Sunday
var holidays = "@Date(2019;8;12):@Date(2019;12;25)"; // assuming your holiday is 12 August and 25th December
var formula = "@BusinessDays(" + startdate + ";" + enddate + ";" + weekends + ";" + holidays + ")";
return session.evaluate(formula);
Date/time constants in Lotus formula language are enclosed in square brackets, which you can clearly see in the documentation for @BusinessDays. Try this:
var formula = "@BusinessDays([" + startdate + "];[" + enddate + "];" + weekends + ";[" + holidays + "])";
return session.evaluate(formula);