• Hello, I want an interval between two dates to be calculated and return the number of days in a hidden field. is this possible?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’m looking for the same thing, user enters two dates and would like to check the length time in between.

    I used this to get a solution

    https://calderaforms.com/doc/cf-state-cf-events-caldera-forms-javascript/

    Scroll down to “Setting Caldera Forms Field Values With Custom JavaScript”

    basically used that code to grade the second date field, grabbed the first date using

    var myFirstDate = document.getElementById(‘fld_9286715_1’).value

    turned both dates into days

    var myFirstTimeStamp = (new Date(myFirstDate).getTime())/86400000; //convert ms to days
    var mySecondTimeStamp = (new Date(value).getTime())/86400000; //convert ms to days

    subtract first date from second date and output days to a new field

    Just added the script to the header, works for my needs, probably a better solution but I’ll worry about that another time, just needed my form to work

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘calculate date ranges’ is closed to new replies.