How to perform calculation using Date Picker

  • Antonio Schmidt
    Asked on December 2, 2023 at 8:16 AM

    Good morning

    I have a small problem to solve with jotform and the google calendar.

    - i create tours with different date and time each time

    - the duration of the tour is also variable

    to import the tour itself in the google calendar the fields must be DataPicker or Appointement.

    - it would be interesting to be able to choose the departure time with a datapicker, indicate the duration and get the result in a second datapicker already complicated with (departure time + tour duration)

    - alternatively use an appointement and enter the desired time and duration

    at the moment I am using two datapicker fields to be filled in manually and a duration field also to be filled in manually, as each tour has at least 1 outward and 1 return I have to enter the tour date 4 times which I personally find impractical.

    Are there any solutions or widgets that can make life easier?

  • Eliza JotForm Support
    Replied on December 2, 2023 at 10:37 AM

    Hi Antonio,

    Thanks for reaching out to Jotform Support. I understand what you're trying to achieve. I checked your account using your email address, and I can see multiple forms associated with it. Can you tell us which form you're working on by providing us with the URL? This is so we can do the test on the form itself and provide you with the correct steps.

    As soon as we hear back from you, we can move forward with a solution.

  • antonio
    Replied on December 2, 2023 at 11:48 AM

    https://form.jotform.com/232811558999069

    hi Eliza, this is a really basic exemple of what I mine...

    the form field are

    date start
    date end

    the price is the ammount of minutes * 3 Euro

    what I'm looking for ist

    A / get the end of tour Start time + Tour Duration

    OR

    B/ get the duration ... End Date - Start time


  • Billy JotForm Support
    Replied on December 2, 2023 at 8:12 PM

    Hi Antonio,

    Thanks for getting back to us and for providing what you're trying to do. We can easily do option A by adding form conditions into the form. The first condition will calculate the end of the tour which is basically Start date + duration (minutes). Here's the form condition:

    How to perform calculation using Date Picker Image 1 Screenshot 50

    The duration field will be added as days by default so we have to convert it first to minutes (duration field (days) / 24 (hours) / 60 (minutes)) then add it to the start date. I understand that this can be complex to set up so I prepared a screencast for you to refer to:

    How to perform calculation using Date Picker Image 2 Screenshot 61

    The next condition is to calculate the cost which is very simple. Using the same trigger as the former condition, we can set it up this way:

    How to perform calculation using Date Picker Image 3 Screenshot 72

    Here's the result:

    How to perform calculation using Date Picker Image 4 Screenshot 83

    You can learn more about conditional log + form calculation using this guide. Finally, here's a sample form that you can check.

    Reach out again if you need any other help.