• Resolved gabrielsgsm

    (@gabrielsgsm)


    Hello support team,

    I’m having a serious problem with the datepicker in Forminator free. I have setup a simple booking form, in which I put a datepicker with the following limitations:
    – All days of week except tuesdays
    – Some date ranges disabled (set 14 – sep 17, sep 21 – sep 24, sep 28 – oct 1)
    – Maximum date selectable (nov 15).

    The problem I have is that, even though the correct dates are selectable, some of them will prompt an error while validating.
    Here are some examples:

    Sunday, September 6th -> Selectable (OK) but not validating (NOT OK)
    Monday, September 7th -> Selectable and validating (OK)
    Tuesday, September 8th -> Not selectable (OK) and not validating (OK)
    Wednesday, September 9th -> Selectable and validating (OK)
    Thursday, September 10th -> Selectable and validating (OK)
    Friday, September 11th -> Selectable (OK) but not validating (NOT OK)
    Saturday, September 12th -> Selectable (OK) but not validating (NOT OK)
    Sunday, September 13th -> Selectable and validating (OK)
    September 18th, 19th and 20th -> Selectable and validating (OK)

    Friday, October 2nd -> Selectable and validating (OK)
    Saturday, October 3rd -> Selectable (OK) and not validating (NOT OK)

    I tested more dates, but this serves as a good sample: I cannot identify the pattern behind it all, nor I can see an error in the javascript console or in the backend. It just doesn’t work and I don’t know why. Can you please help me?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Predrag – WPMU DEV Support

    (@wpmudev-support1)

    Hi @gabrielsgsm,

    I tried creating a form with datepicker by following the explanation provided but I’m afraid that I was unable to replicate the issues with validation.

    Could you please go to Forms list, click on the gear icon and export your form there.
    Upload the export file to any file sharing service like GDrive or Dropbox and share the download link so we can check this further on our end.

    If you don’t want to share the form publicly you can send us the download link by using our contact form https://premium.wpmudev.org/contact/#i-have-a-different-question

    Send in:

    Subject: “Attn: Predrag Dubajic”
    – Link to your page with the form
    – Download link to the export file
    – Link back to this thread for reference
    – Any other relevant urls/info

    Cheers,
    Predrag

    Thread Starter gabrielsgsm

    (@gabrielsgsm)

    Actually, I think I found what the problem was.
    One of my disabled range dates was “November 9th to November 14th”, rendered in the form composer as “11/09/2020 – 11/14/2020”. Since my website is active in Italy/Europe and the typical date format is “dd/mm/yy” (instead of “mm/dd/yy”), I set up my form so that the display date for the final user was “dd/mm/yy”. So, the 11th of Steptember was being rejected during validation because the form read “11/09/2020”, which – as the date format of the backend is “mm/dd/yy” – was being interpeted as “November 9th 2020”.
    By looking into the source code of the plugin, I realized that you use strtotime function to parse the dates and, looking into the documentation of php’s strtotime function, I read that

    Dates in the m/d/y or d-m-y formats are disambiguated by looking at the separator between the various components: if the separator is a slash (/), then the American m/d/y is assumed; whereas if the separator is a dash (-) or a dot (.), then the European d-m-y format is assumed. If, however, the year is given in a two digit format and the separator is a dash (-), the date string is parsed as y-m-d.

    So, I changed the display date to “dd.mm.yy” and now there is no validation error, because the function can correctly recognise that I am using an european format instead of american.

    Plugin Support Adam – WPMU DEV Support

    (@wpmudev-support8)

    Hi @gabrielsgsm

    Thanks for follow-up and letting us know!

    Date formats and validation can, indeed, be a bit confusing sometimes but I see that we also have some improvements related to this already on our “to do” list for the plugin.

    I don’t have an ETA but I can say we’re working on that so it should be significantly improved with one of future releases.

    Best regards,
    Adam

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Datepicker will mark avilable dates as error’ is closed to new replies.