How can I validate check-in and check-out dates?

First, add two Date fields to your form: one for the start date, and one for the end date. There are multiple ways to validate the length of time between the two dates:

  • Calculate the number of days between dates: Add a Calculation field set to the Text type, and use the expression: =CheckOutDate.Days - CheckInDate.Days Make sure to replace the field names with the exact field names on your form.
  • Ensure that the check-out date is after the check-in date: First, set the default value of the check-out date field to match the check-in date: =CheckInDate or the day after the check-in date: =CheckInDate.AddDays(1). Next, set the Minimum range value of the check-out date to match the check-in date:=CheckInDate or the day after the check-in date: =CheckInDate.AddDays(1). You can replace ‘1’ with any specific number of days.
  • Display an error depending on the number of days between the check-in and check-out dates: Set the Custom Error option for the check-out date field to this expression: =(CheckOutDate < CheckInDate.AddDays(30)) along with a custom error message (ex: “Please select a date within 30 days.”) This expression will display an error when the check-out date is more than 30 days after the check-in date. You can replace ‘30’ with any specific number of days.

Learn more in our Date/Time Calculations guide.