Start a conversation

Check if the difference between two dates is between limits

This template checks if after the patient signed informed consent (date1) a visit has taken place (date2) between a day range. 

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 limits you want to use. Replace them with the number of days you want to check for, e.g. 0 and 14. 
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."; 
}

  

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Tonya

  2. Posted
  3. Updated