CASE FrameworkCASE Framework
Survey Editor/Guides

Add a date question with constraints

How to add a date question with dynamic constraints

This guide shows how to configure and connect two date questions that validate answers with minimum and maximum time constraints.

Create a date question by clicking the plus icon in the left toolbar or the "Add a new item" button in the "Items" tab and selecting "Question or Info item".

Select the option "Date Input". The date item is now shown in your item list. Click on the item to see its interface.

Select the component you would like to edit by clicking on it (Read more about item components).

Write your title text. In our example, the title text is: "What is your child’s date of birth?".

Click on "Response options". Set the Date input mode to Year, Month & Day so that participants can provide a complete birth date.

Enter optional Label and Placeholder text, such as "select date here", to guide participants before they make a selection.

Under Earliest, you can define the minimum possible date. For a birth date question, this is usually left open, since the child may be any age.

Under Latest, set the maximum possible date. Click + add value.

In the dropdown menu, scroll to the Misc section and select “Get timestamp". Keep the Offset at 0 days, so that the latest valid date is today. This ensures that participants cannot select a date in the future.

Response Options overview of date input item

Create another date question. In our example, the title text is:
"When was your child’s last vaccination?"

Set the "Date input mode" to "Year, Month & Day".

In the Earliest field, click + add value and select "Get response value as number" in the Response dependencies section.

In the Item key field, click "+ add value" and then "Available item keys". Choose the item key of the previous date question. For response slot key add "rg.date". This ensures that the vaccination date cannot be set earlier than the child’s date of birth.

In the Latest section, click + add value.

Select "Get timestamp". Leave the Offset at 0 days. This restricts the latest possible vaccination date to today.

Use the survey simulator to verify that your constraints are as expected.

Note: “Today” is evaluated in the participant’s local timezone. Participants in different timezones may see slightly different date boundaries on the same UTC day.