Past dates unselectable
-
First of, I think Forminator is awesome!
I’m using it as a restaurant booking form with a date- and timepicker and would like to know if it’s possible to make the datepicker past dates unselectable?
I found some code to restrict the timepicker hours and minutes and was wondering if such kind of code exists for the datepicker.Thanks in advance,
Hans
-
Hello @hauzz
I trust you’re doing well!
This feature will be soon included in the plugin. In the meantime, please try this workaround.
Download this mu-plugin and upload it to /wp-content/mu-plugins/ folder.
If the mu-plugins folder doesn’t exist, please feel free to create it.
Let us know how it went!
Kind regards,
NastiaThanks Nastia, it works like a charm. You’ve made me very happy :-).
Nastia, I was a bit too optimistic. It is true that dates are unselectable but the dat shown in the datepicker is july 19 2025! Every date before is not selectable.
The date in wordpress is set correctly
What went wrong?Hans
Hello @hauzz,
I trust you’re doing well!
I’ve tested the plugin on my end and can’t replicate this issue. The dates start from today’s day. Please see this screenshot
https://take.ms/lIkSoWould you please contact your hosting provider and verify server time-date settings?
Please advise,
Kind regards,
NastiaHi Nastia,
I don’t think that is the case, I tried with two different hosting providers and I have exactly the same outcome on both.
Any way, I did check with my hosting provider and they confirmed the time was correct, must be something else I guess.Regards,
Hans- This reply was modified 5 years ago by Hauzz.
Hello Hans,
I trust all is well!
Would you please make sure that the Hustle plugin is version 1.10.2 ? Please also run a quick test for a conflict with another plugin.
– Deactivate all plugins besides the Hustle and see if the issue is still there,
– If the issue is still there, please witch to a default WordPress theme,
– If all is well, start activating one plugin at the time, every tie checking of the date will be shown incorrectly, to find a plugin that causing this issue.Please have a backup before running this test. If you have a staging site, please do the test there.
If the issue still persists after running a test for a conflict with a theme and other plugins, please export the form and share it with us. You can upload the form to Google Drive or DropBox and share a download link with us.
Please advise,
Cheers,
NastiaHi Nastia,
I hope you’re doing allright.
I deactivated all plugins exept forminator and the code in the mu-folder.
Still the date/time is incorrect unfortunately.
You mention the “Hustle” plugin, I don’t have that, I’m using the code you suggested.
Here’s the link for the export-json: https://drive.google.com/file/d/1qCQZ8c2Lb3VieaW0PofK4xCQdJITMyIk/view
And the test page is here: https://dev.fiks-it.nl/contact/One more strange thing is the mini calendar in the lower left corner below the footer.
Thanks,
HansHello @hauzz ,
I’m sorry for the late response. I’m afraid that you have exported Divi builder not the Forminator form. Can you export form from Forminator?
One more strange thing is the mini calendar in the lower left corner below the footer.
I checked your site and I don’t see any mini calendar under the footer. Can you show me this issue on screenshot?
kind regards,
KasiaI have to apologize too, I have been very busy with another project but this is still important. Below you’ll find the exported form.
{"type":"form","data":{"fields":[{"id":"section-1","element_id":"section-1","form_id":"wrapper-9917-7431","type":"section","options":[],"cols":12,"conditions":[],"wrapper_id":"wrapper-9917-7431","section_title":"Reserveer een tafel","cform-section-border-style":"none","custom-class":"kop"},{"id":"name-1","element_id":"name-1","form_id":"wrapper-3414-2962","type":"name","options":[],"cols":12,"conditions":[],"wrapper_id":"wrapper-3414-2962","field_label":"","placeholder":"Voor- en achternaam","prefix_label":"Prefix","fname_label":"First Name","fname_placeholder":"E.g. John","mname_label":"Middle Name","mname_placeholder":"E.g. Smith","lname_label":"Last Name","lname_placeholder":"E.g. Doe","prefix":"true","fname":"true","mname":"true","lname":"true","required_message":"Het naamveld is verplicht...","prefix_required_message":"Prefix is required.","fname_required_message":"First Name is required.","mname_required_message":"Middle Name is required.","lname_required_message":"Last Name is required.","required":true},{"id":"select-1","element_id":"select-1","form_id":"wrapper-3320-6103","type":"select","options":[{"label":"1 persoon","value":"1 persoon","limit":""},{"label":"2 personen","value":"2 personen","limit":"","default":false},{"label":"3 personen","value":"3-personen","limit":""},{"label":"4 personen","value":"4-personen","limit":"","default":false},{"label":"5 personen","value":"5-personen","limit":"","default":false},{"label":"6 personen","value":"6-personen","limit":"","default":false},{"label":"7 personen","value":"7-personen","limit":"","default":false},{"label":"8 personen","value":"8 personen","limit":"","default":false},{"label":"9 personen","value":"9 personen","limit":"","default":false},{"label":"10 personen","value":"10-personen","limit":"","default":false}],"cols":12,"conditions":[],"wrapper_id":"wrapper-3320-6103","value_type":"single","field_label":"","placeholder":"Aantal personen*","required":true,"required_message":"Het aantal personen is verplicht..."},{"id":"email-1","element_id":"email-1","form_id":"wrapper-9641-8639","type":"email","options":[],"cols":12,"conditions":[],"wrapper_id":"wrapper-9641-8639","validation":false,"placeholder":"E-mail","field_label":"","required":true,"required_message":"Je e-mailadres is verplicht..."},{"id":"date-1","element_id":"date-1","form_id":"wrapper-1020-9320","type":"date","options":[],"cols":12,"conditions":[],"wrapper_id":"wrapper-1020-9320","field_type":"picker","date_format":"dd-mm-yy","default_date":"today","field_label":"","placeholder":"Datum","icon":"true","day_label":"Day","day_placeholder":"E.g. 01","month_label":"Month","month_placeholder":"E.g. 01","year_label":"Year","year_placeholder":"E.g. 2000","required":true,"required_message":"Dit veld is verplicht...","howto-restrict":"week","sunday":true,"wednesday":true,"saturday":true,"thursday":true,"friday":true},{"id":"time-1","element_id":"time-1","form_id":"wrapper-2027-5531","type":"time","options":[],"cols":12,"conditions":[],"wrapper_id":"wrapper-2027-5531","field_type":"select","time_type":"twentyfour","field_label":"","hh_label":"","hh_placeholder":"Uur","mm_label":"","mm_placeholder":"Minuten","required":true},{"id":"gdprcheckbox-1","element_id":"gdprcheckbox-1","form_id":"wrapper-4481-2514","type":"gdprcheckbox","options":[],"cols":12,"conditions":[],"wrapper_id":"wrapper-4481-2514","required":"true","field_label":"","gdpr_description":"<p>Ik ga akkoord met de <a href=\"https:\/\/restaurantbalkan.nl\/privacyverklaring\/\">privacy policy<\/a><\/p>","required_message":"Dit veld is verplicht, Vink het alsjeblieft aan."},{"id":"checkbox-1","element_id":"checkbox-1","form_id":"wrapper-9011-3383","type":"checkbox","options":[{"label":"Voeg een bericht toe","value":"voeg-een-bericht-toe"}],"cols":12,"conditions":[],"wrapper_id":"wrapper-9011-3383","value_type":"checkbox","field_label":"","layout":"vertical"},{"id":"textarea-1","element_id":"textarea-1","form_id":"wrapper-1518-1227","type":"textarea","options":[],"cols":12,"conditions":[{"element_id":"checkbox-1","rule":"is","value":""},{"element_id":"checkbox-1","rule":"is","value":"voeg-een-bericht-toe"}],"wrapper_id":"wrapper-1518-1227","input_type":"line","limit_type":"characters","field_label":"","placeholder":"Schrijf je bericht","condition_action":"show","condition_rule":"any"}],"settings":{"pagination-header":"nav","paginationData":{"pagination-header-design":"show","pagination-header":"nav"},"formName":"Reserveringsformulier","version":"1.10.2","form-border-style":"none","form-padding":"","form-border":"","fields-style":"open","validation":"on_submit","form-style":"flat","enable-ajax":"true","autoclose":"true","submission-indicator":"show","indicator-label":"De gegevens worden verstuurd...","submission-behaviour":"behaviour-thankyou","thankyou-message":"<p>Dank je wel voor je reservering, je wordt per e-mail ge\u00efnformeerd.<\/p>","submitData":{"custom-submit-text":"Reserveer","custom-invalid-form-message":"Er heeft zich een fout voorgedaan, herstel deze alsjeblieft."},"validation-inline":"1","form-expire":"no_expire","form-padding-top":"0","form-padding-right":"0","form-padding-bottom":"0","form-padding-left":"0","form-border-width":"0","form-border-radius":"0","cform-label-font-family":"Roboto","cform-label-custom-family":"","cform-label-font-size":"12","cform-label-font-weight":"bold","cform-title-font-family":"Roboto","cform-title-custom-family":"","cform-title-font-size":"45","cform-title-font-weight":"normal","cform-title-text-align":"left","cform-subtitle-font-family":"Roboto","cform-subtitle-custom-font":"","cform-subtitle-font-size":"18","cform-subtitle-font-weight":"normal","cform-subtitle-text-align":"left","cform-input-font-family":"Roboto","cform-input-custom-font":"","cform-input-font-size":"16","cform-input-font-weight":"normal","cform-radio-font-family":"Roboto","cform-radio-custom-font":"","cform-radio-font-size":"14","cform-radio-font-weight":"normal","cform-select-font-family":"Roboto","cform-select-custom-family":"","cform-select-font-size":"16","cform-select-font-weight":"normal","cform-multiselect-font-family":"Roboto","cform-multiselect-custom-font":"","cform-multiselect-font-size":"16","cform-multiselect-font-weight":"normal","cform-dropdown-font-family":"Roboto","cform-dropdown-custom-font":"","cform-dropdown-font-size":"16","cform-dropdown-font-weight":"normal","cform-calendar-font-family":"Roboto","cform-calendar-custom-font":"","cform-calendar-font-size":"13","cform-calendar-font-weight":"normal","cform-button-font-family":"Roboto","cform-button-custom-font":"","cform-button-font-size":"14","cform-button-font-weight":"500","cform-timeline-font-family":"Roboto","cform-timeline-custom-font":"","cform-timeline-font-size":"12","cform-timeline-font-weight":"normal","cform-pagination-font-family":"","cform-pagination-custom-font":"","cform-pagination-font-size":"16","cform-pagination-font-weight":"normal","payment_require_ssl":"","submission-file":"delete","form_status":"publish","use-custom-css":"1","custom_css":".forminator-input, .forminator-value {\n padding-top:16px;\n padding-bottom:16px;\n}\n.forminator-button {\n float:right;\n }\n\n.kop .forminator-title{\n text-align:center;\n font-family:'Montserrat',Helvetica,Arial,Lucida,sans-serif!important;\n font-size:36px;\n font-weight:500;\n}","use_ajax_load":"1","use_donotcachepage":"1","form_name":"reserveringsformulier","cform-color-settings":"true","button-submit-background-static":"#a13d2d","button-submit-background-hover":"#cd5c5c"},"client_id":null,"notifications":[{"slug":"notification-1234-4567","label":"Voucher Email","email-recipients":"default","recipients":"[email protected]","email-subject":"Nieuwe reservering Restaurant Balkan","email-editor":"<p> <\/p>\n<h2>Er is een nieuwe reservering van de website\u00a0<\/h2>\n<p><strong>Gegevens van de aanvraag<\/strong>:<\/p>\n<p>Naam: {name-1}<br \/>Datum: {date-1}<br \/>Tijd: {time-1-hours}:{time-1-minutes}<br \/>Aantal: {select-1}<br \/>E-mailadres: {email-1}<\/p>\n<p>Bericht: {textarea-1}<\/p>\n<p> <\/p>\n<p>Bevestig de reservering door op de knop \"Reservering met voucher bevestigen\" te drukken.<\/p>","from-name":"Restaurant Balkan","form-email":"[email protected]"}]},"status":"publish","version":"1.10.2"}
Thanks for your time,
HansHi @hauzz
Thanks for sharing the form and I’m sorry for keeping you waiting.
I was able to replicate the issue with your form and with further troubleshooting I also found out why it’s happening.
The plugin that you’ve been given is a JS-based “workaround” so it’s updating form data “on the fly” and the form is quite “sensitive” to date format.
It seems (and that’d be the reason why my colleagues couldn’t replicate the issue) that the date format used in plugin is different than the one used in your form.
If you’d rather not change the format on the form, you can fix it by editing the MU plugin that you’ve been given and update this line in it
var today_date = mm + '/' + dd + '/' + yyyy;
to be like this
var today_date = mm + '-' + dd + '-' + yyyy;
This will fix the issue. For future reference (until the update to Forminator is released addressing this), it will work fine as long as date format in this line of the code is matching the date format set in the form field configuration.
Best regards,
AdamHi Adam,
Thank you very much for helping me out with this issue.
I changed the plugin in: var today_date = dd + ‘-‘ + mm + ‘-‘ + yyyy; as is usual in Europe and now it works as expected.Thanks again,
Hans
- The topic ‘Past dates unselectable’ is closed to new replies.