My Date logic is not using Month and Day only the day for calculation

  • AgilityAssoc.Canada
    Asked on May 24, 2018 at 10:17 PM

    Hi,

    On 52745887899988, I have logic checking dates to verify that they are correctly indicated. In one case I compare the Approved Date (AD) with the Trial Date (TD)

    The TD should never be before the AD. The logic is not checking month values only the day value so it indicates an Error for a TD June 23 and AD May 24.

    1527214548date error error Screenshot 10

    1527215031TDvsAD Screenshot 21

    This is likely the case for all these logic conditions as well. So right now I have the one outlined disabled.

    Is there a way around this?

    Thanks Robert

  • Scott JotForm Developer
    Replied on May 25, 2018 at 2:40 AM

    Hey Robert,

    You can achieve this by using form calculation widget, which will be able to calculate the epoch time difference between two date fields.

    1527230346Screen Shot 2018 05 25 at 09 Screenshot 10

    After this, you will be using this result in a show/hide condition as shown below:

    1527230387Screen Shot 2018 05 25 at 09 Screenshot 21

    Here is my test form: https://form.jotform.com/81441690423958

    Feel free to clone it if you feel the need for further inspection.

  • AgilityAssoc.Canada
    Replied on May 25, 2018 at 9:30 AM

    Hi,

    I tried something similar for three of the dates on my clone 81394598650974 and it is not calculating this particular date correctly. It appears to be set right but unlike the other two it shows zero when there are no dates and a zero if TD is on the 24th of a month and AD is on the 24 of any month.

    answers Screenshot 10

    So what is happening to make this calc so different?

    Robert 

  • AgilityAssoc.Canada
    Replied on May 25, 2018 at 9:55 AM

    1527256115TD Error Screenshot 10

     

    Note the strange value between Received date and Approved date, -300. 

    1527256447RD error Screenshot 21

    This shows the same error in calc as the other, months are not used again.

    Note I cannot use an other widget because of integration so I cannot use Date Picker as you do.

    Robert

  • Kiran Support Team Lead
    Replied on May 25, 2018 at 11:19 AM

    Unfortunately, the widget doesn't support to send the data in date format. The widget is sending the text of the date as numbers to the calculation field i.e., 2118 from 21 May, 18, 2418 from 24 May, 18 and 24 May, 18 which is resulting 0. Most of the widgets are loaded in iframe and returns the value as a string which might not work with calculations. In order to perform calculations with dates, it is currently possible with Date field only. 

    Thanks!

  • AgilityAssoc.Canada
    Replied on May 25, 2018 at 3:21 PM

    OK... I will just delete all this and go without...

    Thank you, Robert