Can I subtract a fixed date from a user entered date field?

  • hilltopkennels
    Asked on June 26, 2014 at 5:16 PM

    In my Hilltop Kennels Reservation Request form I have a daily heating charge which applies to the days of a multi-day booking which fall in the heating charge period (1st Oct until 30th April).

    For each booking I need to calculate the number of days which lie within the heating charge period in order to calculate the total heating charge.

    For example a booking as follows;

    29th Sept - 3rd Oct would incur a heating charge for 3 days (1st - 3rd Oct)

    or a booking for the following dates;

    29th Apr - 17 May would incur a heating charge for 2 days (29th - 30th Apr)

    a booking for the following dates;

    3rd Nov - 5th Nov would incur a heating charge for 3 days as it falls entirely inside the heating charge period

     

    Thanks to the extra functionality now available within Jotform I have managed to fix all the outstanding issues with the reservation form, this is the only thing I need to crack now!

    Fingers crossed you guys can help!

    Simon

  • jonathan
    Replied on June 26, 2014 at 5:39 PM

    Hi Simon,

    From what I can see in your form https://www.jotform.com/40394782855365, it seems that you have this functionality on the form already?

    Can I subtract a fixed date from a user entered date field? Image 1 Screenshot 20 

    Please tell us if this is not yet complete.

    And also, I need clarification the "fixed date" variable -- when you say fixed date, does it need not be the current date? I understand it may have impact on the calculation.

    If it only means to be always the current date, then it will be simpler because you can just assigned it on the Date/Time field to use the current date.

    Please inform us if you need further assistance.

    Thanks!

     

     

     

  • hilltopkennels
    Replied on June 27, 2014 at 2:08 AM

    Yes I need the date to be a fixed date, not the current date. i.e. 1st October and 30th April (start and end dates of the chargeable heating days)

  • jonathan
    Replied on June 27, 2014 at 5:31 AM

    You can also pre-populate the fixed date using Field Prepopulator App

    By pre-populating the field, you can then assign a fixed date to it that the form user cannot alter.

    Will this solution work for you? Please update us.

    Thanks.

     

  • hilltopkennels
    Replied on July 5, 2014 at 12:21 PM

    I think it will, I'll get back to you once I've had a go and either fixed or need more help! Thanks guys.

  • hilltopkennels
    Replied on July 5, 2014 at 12:58 PM

    Ok I don't think this app will work for me.

    My form asks a user to enter an arrival date and a departure date for their dog (or cat) to be boarded.

    To calculate the fee owed, I need to evaluate how many of the days in the booking lie within the days defined as requiring a heating charge (these are any booking dates between 1st October 2014 and 30th April 2015)

    As far as I can tell (I haven't worked out the logic yet, I would need a hard-coded date of 1st October 2014 and 30th April 2015 set as read-only, hidden fields. Once the user has entered their booking dates the number of days of heating charge can be evaluated.

     

    i.e. booking from 29th September until 3rd Oct

    29th Sep - no heating

    30th Sep - no heating

    1st  Oct - heating charge

    2nd Oct - heating charge

    3rd Oct heating charge

    so a total of 3 x heating charge

     

    so I assume logic will be something like ([1st Oct 2014] - {arrival date}) * {heating charge}

    Problem is it seems to be difficult to have a field with a fixed read only date value

     

    Any ideas?

  • KadeJM
    Replied on July 5, 2014 at 4:03 PM

    I think that your mentioned calculation should work, but the problem is that the date needs to be more of a fixed or specific date for this to work otherwise it is going to fall apart after the fact since after looking more at it I believe that this is what is probably causing your issue with it.

    You can probably also work around the date issue by pre-populating the date field which is the hard-coded date you had previously mentioned which should also work. Alternatively, just use it with a text-box field and a fixed date value then you just need to hide it. 

    If that doesn't work then let us know and we will try to test it further to come up with something else.

  • hilltopkennels
    Replied on July 6, 2014 at 3:17 AM

    I'm struggling how to do it, can you assist with the required syntax?

     

    The heating start date is always the same, 1st October 2014. I just need to evaluate how many days (if any) in the booking, fall after 1st October.

  • jonathan
    Replied on July 6, 2014 at 6:32 AM

    Hi Simon,

    Let me create a demo form for you that simulate this.

    I will get back to you quickly.

    Thanks.

  • hilltopkennels
    Replied on July 28, 2014 at 2:09 AM

    Any news re the demo form?

  • Ashwin JotForm Support
    Replied on July 28, 2014 at 4:07 AM

    Hello hilltopkennels,

    Your message has reached my colleague @jonathan. He is not available online right now but will get back to you as soon as he is back. I have also sent him a note on this.

    Thank you!

  • hilltopkennels
    Replied on August 10, 2014 at 4:58 AM

    Still not heard anything? Do I assume this isn't possible to do?