Decimal-date-time does not seem to work on ODK Collect as it does on Enketo or other webforms

Problem
Using the decimal-date-time on datetime questions to allow for computation of time difference between two datetime question one can always use the example below
round(((decimal-date-time(${DateTime_Return}))-(decimal-date-time(${DateTime_Departure})))*24,2)

Unfortunately, the operation only works on webforms to produce the exact number of hours while on ODK Collect this only returns the hours rounded off to days i.e. 24, 48, 72 etc.

An example of such a form is here Hours Calculated Between Dates v2.xlsx (18.9 KB)

Workaround
I had to change the logic for calculating the difference by splitting the datetime into two questions, date and time. And using absolute date difference and decimal-time difference between the times measured. This is the only approach that works on Collect.
round(((decimal-time(${Time_Return}))-(decimal-time(${Time_Departure})))*24,2)+round(((${Date_Return})-(${Date_Departure}))*24,2)

Hours Calculated Between Dates v3.xlsx (19.9 KB)

To reproduce
I suggest that you test the two forms I have uploaded on both web forms and collect

Query

  1. Is this a known bug with the latest collect
  2. Has this ever occurred in previous versions of collect

Stephane

Hi Stephane:

In this post https://forum.getodk.org/t/pull-datatime-from-csv-works-on-enketo-but-not-on-odk-collect/37215/3?u=mauricio_andres_arci you can see a function for calculating the difference between times that provides the same results in Enketo and in ODK Collect.

Mauricio