String returned by "dateString" function is one day earlier than date given.

  • Profile Image
    bhds
    Asked on March 20, 2015 at 12:22 PM

    I have set up a form with a DateTime field, and want to be able to display a string that includes the day of the week on which that date falls.  To do so, I added a Form Calculation field to my form, and used the following formula for the calculation:

    dateString ({dateOfSupply})

    where {dateOfSupply} is the source DateTime field.

    For some reason that I can't fathom, the date string returned by this formula is one day earlier than the date entered in the source DateTime field.

    Can you explain why this is happening?  If I add one to the value of {dateOfSupply} then I get the result that I want, but I don't believe that this is the ideal solution.

    Thank you.

  • Profile Image
    raul
    Answered on March 20, 2015 at 01:34 PM

    I've checked your form and was unable to reproduce the issue.

    Can you try to clear your browser's cache and load your form again?
    I've also cleared your forms cache to make sure it's not a cache issue.

    Let us know if the issue persists.
    Thank you.

  • Profile Image
    bhds
    Answered on March 22, 2015 at 10:01 PM

    I have done some more investigation into this, and asked two people that I know in other countries to try the form.  The results were as follows:

    Canada:  Error occurs, i.e. dateString function returns a date one day earlier.
    England:  Error does not occur.
    Israel:  Error occurs.

    I am currently in Toronto, and the timezone on my computer is set accordingly.  When I change the timezone on my computer to England and the clock on my computer to the time in England, the problem with the dateString function does not occur.  I am therefore of the opinion that there is a bug in the code behind the dateString function that is returning an incorrect value depending on which timezone one's computer is set to.  Do you know when this will be fixed?

    Thank you.

  • Profile Image
    Welvin
    Answered on March 23, 2015 at 03:36 AM

    I was able to replicate the problem, here's a screenshot:

    Here's my test form: http://www.jotformpro.com/form/50811393557963.

    I have now submitted this thread to our developers so they can advise us of what to do about this matter. I think that's because of the timezone settings.

    If there are updates, you should know it via this thread.

    Thank you!

  • Profile Image
    bhds
    Answered on March 24, 2015 at 11:03 AM

    I just tried this, and the correct value was returned by the dateString function.

    Thank you.

  • Profile Image
    raul
    Answered on March 24, 2015 at 12:12 PM

    You're welcome.

    We're glad to know that the function is working as expected.

    Feel free to contact us anytime, should you require our assistance.
    Kind Regards.