This template checks whether a visit (date2) took place within a specified day range (XX to YY days) after the patient signed informed consent (date1).
In this template:
date1 and date2 are two date fields in your form. Replace them with your own variable names.
XX and YY are the lower and upper limits (in days) you want to check for, e.g.,
0and14.
if ('{date1}' !== '' && '{date2}' !== '') {
var dateDiff = getDateDiff('{date1}', '{date2}', 'day');
if (dateDiff < XX || dateDiff > YY) {
"Difference between date1 and date2 has to be between XX and YY days, it's currently " + dateDiff + " days.";
} else {
"";
}
} else {
"";
}