I have a form where 3 date + time pickers question are given and I want to use validation condition to make sure the consequent answers are always later in time ( time left < time of arrival < time finished).
I have tried already to put it plain in the validation conditions which did not work
and I did try to use double() and double(date()) options as suggested in the topic below (and the suggested link):
Does someone has suggestions to get this validation condition?
Thanks for the suggestion. To clarify I indeed need ‘time_left < time_of_arrival’ for second entry and ’ time_of_arrival < time_finished’ for the last question
This works I think for the day picker, but appears not to work for the day and time picker.
Jos, to compare dates and times, you may need double(), as you mentioned in your first link, though if you use date(), it will drop the time information, so the comparisons may be off. Could you paste in the exact expression you’re using?
Yes I am aware of the nuances of this type of comparison, as we are in UTC and non daylight saving area I can accept the risk. And would prefer to keep the date for the occasional difference of dates.
As from the documentation and links provided above I would expect to get a decimal from the epoch with after the ‘.’ the day fraction. I made a test app to visualize the results. tl = time_left ar = arrival both are date and time picker questions with same date but different time:
normal = unaltered
string = string()
double = double()
double_date = double(date())
I would expect to see time info at normal, but I do not see any. With using data export tool to database I actually do see the time info, so the info is there.
At double I would expect to get a decimal with time info but it shows an integer, meanwhile with the double(date) option I would expect it to cut of to whole days (integer) but shows a decimal instead, but the time info is the same meanwhile entered times are different.
To me I do not see the logic of this behaviour.
I just tested it out and observed the same behavior you’ve described. As you’ve mentioned, “date and time” questions are stored properly for exports, but don’t seem to be well suited for calculations. It might be easier to work around this issue by instead using two questions, one for the date, and a second for the time. tl-date and tl-time, for example. Then for validation, you can compare dates, or if the dates are the same, compare the times. Something like:
Thanks indeed I think you are right I might have to look for something like that. I will discuss the options with persons who are actually using the app and see which option we prefer.
The main reason I need the validation is the UI of the date and time picker as by swiping to the next question one could easily change the input.