The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group
Help with Calendar dates please
Hi all,
Some help if possible please.
My client site is using a form for the booking system at the top of each page - https://euroselfdrive.co.uk/
When you use the "pick up" date range a user cannot select further than 58 days ahead in the year. I've looked everywhere I can think of (with my limited knowledge) and can't seem to find the answer, so it must be in deeper than just the WP admin panel.
Any help out there greatly appreciated!
June 16, 2017 at 5:22 am
Your page has the following jQuery script:
(function($)
{
"use strict";
$(document).ready(function(){
$("#field_3mnizm").datepicker({
dateFormat: 'dd-mm-yy',
beforeShowDay: function(date) {
var day = date.getDay();
return [day != 0,''];
},
minDate: 3,
maxDate: '+2m',
numberOfMonths: 1,
onSelect: function(selected) {
var date2 = $('#field_3mnizm').datepicker('getDate');
date2.setMonth(date2.getMonth() + 1);
$('#field_3mnizm').datepicker('option', 'defaultDate', selected);
$('#field_hg02xp').datepicker('option', 'minDate', selected);
$('#field_hg02xp').datepicker('option', 'maxDate', date2);
}
});
$("#field_hg02xp").datepicker({
dateFormat: 'dd-mm-yy',
beforeShowDay: function(date) {
var day = date.getDay();
return [day != 0,''];
},
});
});
})(jQuery);
The maxDate parameter limits the selection to 2 months out. Change this parameter to increase the date picker range, or remove it to end the restriction.
I can't tell you for certain where the developer placed this code, but the first place I'd look is the forms Settings / Customize HTML page in the After Fields meta box.
June 16, 2017 at 9:06 am
Hi Victor,
Thanks so much for your help.
I've had a look where you suggested and there was just a lonely </div> tag in that particular box. I scanned the rest of them and no mention of this bit of code "maxDate: '+2m',"
I have full FTP access, is there a way of finding where that code might be by using Chrome inspect tool? Then I can edit the file directly, prob just remove it ideally.
Thanks again.
June 16, 2017 at 1:01 pm
The code can be loading from any place the developer used to load jQuery code. You have several scripts loaded right after each other. Since the scripts are being written out instead of being enqueued, it indicates the developer might be injecting the scripts from functions.php. It can also be coming from a plugin or even the theme itself. It's impossible to say from looking at the generated source code on the front end.
June 19, 2017 at 8:54 am
Victor, you Sir are a legend!
After a bit of hunting, I found the offending code in the footer.php file, and Woocommerce files for another Calendar function they are running. Removed the +2m bit and all is working great.
Thanks so much for you help, I was wasting too much time trying myself.
June 19, 2017 at 9:27 am
I'm glad you figured it out.
June 21, 2017 at 1:38 pm
Yes, you are pretty great, Victor! Awesome help. ??
Discussion closed.