Compare date fields in validation rules

You can now compare one date field directly with another in validation rules and conditional logic. For example, require an end date to be on or after a start date, without creating a formula first.
Set up a date comparison
- Open the settings for your End date field and select Validation.
- Click Add rule, select End date, and choose On Or After.
- Switch Fixed date to Field or variable, then select Start date.
- Add an error message, such as “End date must be on or after start date,” and save your form.
You can also use Equals, Before, After, and On Or Before. The same selector is available when configuring conditional display logic.
Use a computed variable
The selector also accepts computed variables that return a date. Under Settings → Variables, click Add Variable and create a variable referencing your start date, for example {Start date}. Then select that variable under Field or variable in the end date's rule. Use a variable with Auto or Text output that returns an ISO date.
You can also keep the comparison itself in a reusable variable. For date-only fields, create a variable named Dates valid with this formula:
IF( OR(ISBLANK({Start date}), ISBLANK({End date})), 0, IF( SUBSTITUTE(LEFT({End date}, 10), "-", "") >= SUBSTITUTE(LEFT({Start date}, 10), "-", ""), 1, 0 ))Insert your actual fields using the formula editor's field references. This returns 1 when both dates are filled and the end day is on or after the start day, and 0 otherwise. In End date → Validation, add a rule requiring Dates valid → Equals → 1. The formula uses the calendar-day part of OpnForm's ISO date values; for dates with time, use the direct date comparator instead.
Good to know
- Field references must use matching settings: both date-only or both including time. Date ranges are not included.
- Date-only fields compare calendar days. Fields including time compare instants, with timezone offsets taken into account.
- Empty or invalid dates do not pass the comparison. To allow an empty optional end date, use End date is empty OR End date is on or after Start date.