Can a require a time gap between two times entered?

  • Profile Image
    Asked on January 23, 2020 at 07:02 PM

    I am creating an application where I need to know the start time for 2 meal services, but it is required that the start times must be 3 hours apart and the meals times cannot overlap. Is there a way to put this restriction on the application?

  • Profile Image
    Answered on January 23, 2020 at 10:30 PM

    Hi, probably the only close solution would be calculating the difference with a Form Calculation widget:


    Then, create a condition to show a warning and hide the submit button:




    Unfortunately, there is no way to prevent that the "Until" part of the "Snack service" overlaps with the start time of the "Lunch Service". Let us know if you have more questions.

  • Profile Image
    Answered on January 24, 2020 at 03:39 PM

    Thank you for your help. The widget works if snack service is always before lunch. But what if there is the possibility that the snack happens after lunch as well? The numbers become negative. Is there a way to get around that?

  • Profile Image
    Answered on January 24, 2020 at 05:31 PM

    I think I found a workaround, please test this form:

    I basically added another Form Calculation widget to turn the negative value to positive:


    And set up this conditions:




    You may clone it if you want to: