How to calculate the difference between two dates and a fee based on those dates

  • Profile Image
    DownwardDogATX
    Asked on May 04, 2016 at 02:10 PM

    I am trying to create a form for my dog sitting business where the user can input the dates and it will automatically calculate their total and let them pay through PayPal. Is there a way to do that? I've been playing with it for a while and I can't seem to figure it out :/

  • Profile Image
    david
    Answered on May 04, 2016 at 03:27 PM

    You can achieve your requirement with using our Form Calculation widget.

    First you need to add 2 date fields to your form. Then add Form Calculation widget and configure it to calculate the number between two dates. 

     

     

    If you want to calculate the difference between today and the other date field you can set first date field’s value to default and hide it. This will set date field value to today and it will never be seen on your form. 

     

     

    You can find additional information about Form Calculation widget here.

    Once you have the number of days calculated, you can add another calculation widget to calculate the total fee or you can include the fee calculation in your original calculation.  When you have your total, you can pass that total to PayPal for payment processing:

    https://www.jotform.com/help/275-How-to-pass-a-calculation-to-a-payment-field