DateTime Calculation : Issues with MuliLingual Display

1. What is the issue? Please be detailed.
I have a multilingual form with two datetime questions to be filled out by enumerators. They are essentially a start and a stop time for a timesheet showing what activity they were doing during that time. I would like to calculate the difference between these datetimes as well as display that difference in number of Hours and Minutes to the enumerators after they complete both questions.

I think there is an issue with the int() operator on a datetime value in English. ${calc_minutes_total_disp} and ${calc_hours_disp} are not displaying properly as labels in English in ODK Collect v2024.3.0 Beta 7 and Enketo even though when submitted, the values submitted /in the database are the correct ones, the same as the ones that show up in the other languages.

2. What steps can we take to reproduce this issue?
Use the attached XLSForm via Collect or Enketo and put in times that are different and then change languages from English to the other two. English is the only one that isn't displaying ${calc_minutes_total_disp} and ${calc_hours_disp} correctly.

3. What have you tried to fix the issue?
I tried what was recommended by @Mauricio_Andres_Arci here

int((decimal-date-time(${time_end})-decimal-date-time(${time-start}))*24*60)

I also tried what was recommended here

Essentially I'm wanting to do a rounddown() function, which seems like is not actually a function and instead posts like this are recommending to convert using int() but that isn't functioning properly.

4. Upload any forms or screenshots you can share publicly below.
TimeDate_Example.xlsx (11.9 KB)

I should note I saws several posts about constraints for timedate questions, and I should note this form shows two examples, one where the start time constraint is non future (must be now or in the past). The second, end time, must be non future AND is after the start time as mentioned here. I struggled for a bit trying to using things like:

. <= date(today())
. <= date(now())

which didn't fully work.

Would you mind to try what happens if you use/change the same language for the app and the form, please? (Your 2nd screenshot shows a mix of EN and FR.)

Hi @Tyler_Depke

I don't see anything wrong in the way ODK works. The problem seems to be in the way you built your label in English:

${calc_hours_total1} hours1
${calc_minutes_total} Minutes Total
Integer Minutes: ${calc_minutes_total_disp}
${calc_hours_disp} Hours, ${calc_min_remainder} Minutes

there is no separator between ${calc_minutes_total_disp} and ${calc_hours_disp} so in your case where you expect to display something like:

Integer Minutes 60
Hours 1

the values are together and displayed as 601

1 Like