Calculating against Date brought in 1/1/2017 format (not 01/01/2017)

  • IntegritySurety
    Asked on November 27, 2017 at 10:36 AM

    Good morning! I need to calculate against Date brought in via URL, the source of which does not place leading "0" in dates, so January 1 would be 1/1/20xx instead of 01/01/20xx.  Obviously, the date picker is having a problem with this, and I need to calculate whether the brought-in date has "passed". 

    Clearly, calculating two date pickers (entered vs. today's date) against each other would work, but I can't get the date picker to accept 1/1/2017. I tried Text field calculated into a value, then back-calculated into a string, (as shown on Forum form https://form.jotform.com/73214806889972), but that doesn't appear to work either.

    Thoughts? Thank you!

  • Mike_G JotForm Support
    Replied on November 27, 2017 at 2:05 PM

    We would like to apologize for any inconvenience. However, if you are trying to pass a date value via URL parameters into a date field which is in lite mode, I'm afraid that would not be possible.

    1511809465t14 03 37 Screenshot 10

    Also, the date field with lite mode enabled only accepts a sequential number that represents a date. For example, 1 represents the date, 01-02-1970, and 17168 represents 01-02-2017.

    If you want to pass a date field value from a URL parameter, you can only do it using the date field with lite mode disabled. And here is the format — https://form.jotform.com/73304575934966?date9[month]=1&date9[day]=1&date9[year]=2017

    I hope this helps. If you have other questions, please feel free to let us know.

  • IntegritySurety
    Replied on November 27, 2017 at 2:33 PM

    OK, thanks, I fiddled with it. Can you think of a way to magically "convert" or "Calculate" the short-text 3/1/2017  into Non-Lite-Mode date picker individual fields? I don't mind having multiple hidden fields or calculations, as I can't amend the format of the inbound URL data

  • Mike_G JotForm Support
    Replied on November 27, 2017 at 7:46 PM

    I would like to apologize for any inconvenience. However, it is also not possible to pre-fill the individual fields of a non-lite-mode date picker field without using the format I provided you above.

    Since you mentioned that you don't mind having multiple hidden fields or calculations, I have created a form that I believe will help you meet your requirements. The form still uses a date picker with lite mode enabled. To test the form, you just need to change the value of the "dateFrom" parameter from this URL — https://form.jotform.com/73305813034953?dateFrom=2/4/2017

    1511829560t19 34 37 Screenshot 10

    Note: I have hidden the other fields that make the calculation works using CSS codes. To view them, you can remove the injected CSS codes from the form when you clone it — How-to-Clone-an-Existing-Form-from-a-URL

    I have used several Substring widgets and conditions to separate the month, the day, and the year of the date value in the URL and converted it to a numeric value that will be accepted by the Date Picker field.

    I have used the DateTime Single widget as a trigger to pass the value(s) across the form on form load.

    I hope this helps. If you have other questions or concerns, please feel free to contact us again anytime.

  • IntegritySurety
    Replied on November 28, 2017 at 10:29 AM

    holeeeee crap that's amazing. I can't believe you made that. 37 conditions! Man, people wanted me to use a competitor, but I'm daily thankful for JotForm!