Validating a time field against another time field

I have a question that asks something like “what time do you start work” and another question that asks “what time do you end workday” all have time as type. I want to restrict the last question so that it does allow one to select a time that is earlier than the first question. The constraint i tried on the second question to make it to be greater than the first is not working. Any help?

You can use decimal-time() function, see ODK XForms Specification.
Here is an example, found with the famous search function of this forum: Timesheet system with clock in and clock out using time from the internet

1 Like

@mkamzati, you could do it as advised by @wroos following the image shared below:

In the survey tab of your XLSForm:

Data entry screen as seen in Enketo: when End time is less then the Start time

Data entry screen as seen in Enketo: when Start time and End time are same

Data entry screen as seen in Enketo: when End time is greater then the Start time

Reference XLSForm:

TIME.xlsx (9.9 KB)

Thank you this has helped

1 Like