How to add days to a date calculation

  • Profile Image
    mjbiggie88
    Asked on August 28, 2017 at 02: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

  • Profile Image
    Welvin
    Answered on August 28, 2017 at 02: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:

  • Profile Image
    mjbiggie88
    Answered on August 28, 2017 at 03: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.

    Thanks again for your help,

    Mat

  • Profile Image
    aubreybourke
    Answered on August 28, 2017 at 05: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.

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