Expand date/time question types

Use cases: Frequently, survey collect date and time in different formats than what Survey Solutions allows directly. Examples:

  • Facility opening/closing time. Consists of HH:MM AM/PM
  • Harvest time. Consists of MM/YYYY.
  • Year enterprise founded. Consist of YYYY
  • Bonus: duration or several dates (see another user’s request here)

Implementation ideas:

  • Where a broader question type exists, create more options (e.g., MM/YYYY should be an option for the date question)
  • Where necessary, create new question types (e.g., time questions with HH:MM AM/PM seem like a new question type)

See ODK’s date and time widgets here.

It seems like Anroid has selectors for each of the proposed new question types. It is just a matter of creating question types/variants that utilize these existing selectors.

Work-arounds:

All of the above needs have work-arounds. But those work-arounds require more time of the CAPI app developer. For example, to capture opening time, one needs to create 3 fields–hour (numeric), minute (numeric), AM/PM (single-select)–and write validations to ensure that the combined inputs make sense.

Just writing to second this motion for more specific support of time-of-day inputs, including the ability to calculate the difference between a start time and an end time in a logically consistent way.

For example:
Q: What time do you begin using this appliance?
A: 5:30 AM

Q:What time do you end use of this appliance?
A: 8:30 PM

Variable: Double
Time difference in hours: 15

  1. The difference between tow datetime typed objects should be used to easily calculate the difference between two time points represented as a TimeSpan that can be subsequently expressed in any units, such as hours or minutes.

  2. my recommendation would be to enter the time as 0530 and 2030 for the above examples and use the function IsMilitaryTime() to verify the content indeed is a valid time. Specifically, for the following patterns, specify exactly the following validations:

#### IsMilitaryTime(self)
##:## IsMilitaryTime(self.Replace(":",""))

In both cases the time to be entered in 24-hour format.