How to add days to a date calculation

  • mjbiggie88
    Asked on August 28, 2017 at 2:15 PM

    I'm building a pregnancy test calculator, and I've used the datepicker to determine a user's first day of their last menstrual cycle.

    I then used a dropdown to allow users to choose their average cycle length.

    I need to add up the results from the dropdown with the results from the datepicker and then subtract 6 days from it to get a new date.

    Is there a way to do this using the form calculation widget?

     

    Thank you in advance,

    Mat

    Jotform Thread 1234302 Screenshot
  • Welvin Support Team Lead
    Replied on August 28, 2017 at 2:47 PM

    I'm sure that is possible. I am just confused about the formula that is being used. 

    Is that when they select 28 from the "First Day of Your Last Period" date field, that means 28 + the selection in the dropdown? Can you share us the formula?

    Note that the calculation will work best with Date Picker in the Basic section of the form builder, see screenshot:

    How to add days to a date calculation Image 1 Screenshot 20

  • mjbiggie88
    Replied on August 28, 2017 at 3:39 PM

    Thanks Welvin, and sorry for the confusion. 

    I updated the form with the basic date finder and dropdown and I'm still having a similar problem.

    I need to add the "average cycle length" selection (the dropdown allows anything from 7-48 days) to the date chosen in the "first day of your last period" field.

    Here's the screenshot of the formula.

    How to add days to a date calculation Image 1 Screenshot 20

    Thanks again for your help,

    Mat

  • aubreybourke
    Replied on August 28, 2017 at 5:53 PM

    I managed to create a demo for you:

    https://form.jotformpro.com/72396973786983

     

    If you would like to clone my form:

    How to Clone an Existing Form from a URL

     

    I use two form calculation widgets.

    One for the calculation of the average minus six days.

    How to add days to a date calculation Image 1 Screenshot 30

    The other (due date) uses the detesting function on the first day plus the calculation.

    How to add days to a date calculation Image 2 Screenshot 41