areDatesEqual( )
Compare two dates to determine if they are equivalent.
Syntax
Note:
This function is used to compare variables of type date that do not contain time elements. When using a date/time type parameter, function considers only date part and ignores time elements.
You can use the areDateTimesEqual( ) helper function to compare two date and time items.
areDatesEqual(date1, date2)
Return value
True, if dates are equal; false, if they are not.
Example 3-20 Compare two Date items
// Given 2 form questions of type DateTime are defined in the rule as variables
if (areDatesEqual(date1, date2)) {
return false;
} else {
return true;
}
// Triggers a query if this is a query rule and dates are equal.
Example 3-21 Compare two hard-coded Date items
var date1 = new Date("March 20, 2020");
var date2 = new Date("March 1, 2020");
if (!areDatesEqual(date1, date2)) {
return false;
} else {
return true;
}
// Triggers a query if this is a query rule and dates are NOT equal.
Parent topic: Date and time functions