Hi experts,
I am not getting anywhere here.
The goal is to put out the number of individual weekdays days between two date fields.
In my form I could already generated a code, that put out the total number of working days in the entered period of datefield1 and datefield2.
How exactly can I realize that at the end is displayed for example:
Number of Mondays: 2
Number of Tuesdays: 2
Number of Wednesdays: 1
Here is my file:
Views
Replies
Total Likes
try this
var startDate = new Date('15/03/2022');
var endDate = new Date('25/03/2022');
var numOfDates = getBusinessDatesCount(startDate,endDate);
function getBusinessDatesCount(startDate, endDate) {
let count = 0;
const curDate = new Date(startDate.getTime());
while (curDate <= endDate) {
const dayOfWeek = curDate.getDay();
if(dayOfWeek !== 0 && dayOfWeek !== 6) count++;
curDate.setDate(curDate.getDate() + 1);
}
app.alert(count);
return count;
}
Could you help me again and tell me where I should use that code in my following form?
The goal is to get a value of each working day in the entered period.
Here is my form:
@UKE87 I dont see the form.
here is the reference doc:
https://helpx.adobe.com/pdf/aem-forms/6-2/scripting-basics.pdf
Here is the link to my form: https://www.acronaut.de/download/file.php?id=10008
It would be great, If you could help me with the code in my form.