Reply To: Checkin date inferior to Checkout date

Home Forums Quform WordPress Checkin date inferior to Checkout date Reply To: Checkin date inferior to Checkout date

#35463
azoreslab
Participant

Hi

Thank you a lot.
I’ve changed the code, so it would not show the days before today.

const date = new Date();

let day = date.getDate();
let month = date.getMonth() + 1;
let year = date.getFullYear();
let currentDate = ${year}, ${month}, ${day};

jQuery(function ($) {
var start = $(‘.quform-field-1_43’).data(‘kendoDatePicker’),
end = $(‘.quform-field-1_47’).data(‘kendoDatePicker’),
daysBetween = 1;

if (start && end) {
start.setOptions({
change: function () {
var startDate = start.value(),
endDate = end.value(),
newStartMax, newEndMin;

if (startDate) {
newEndMin = new Date(startDate);
newEndMin.setDate(newEndMin.getDate() + daysBetween);
end.min(newEndMin);
} else if (endDate) {
newStartMax = new Date(endDate);
newStartMax.setDate(newStartMax.getDate() – daysBetween);
start.max(newStartMax);
end.min(new Date(console.log(currentDate)));
} else {
start.max(new Date(2099, 11, 31));
end.min(new Date(console.log(currentDate)));
}
}
});

end.setOptions({
change: function () {
var endDate = end.value(),
startDate = start.value(),
newStartMax, newEndMin;

if (endDate) {
newStartMax = new Date(endDate);
newStartMax.setDate(newStartMax.getDate() – daysBetween);
start.max(newStartMax);
} else if (startDate) {
newEndMin = new Date(startDate);
newEndMin.setDate(newEndMin.getDate() + daysBetween);
end.min(newEndMin);
start.max(new Date(2099, 11, 31));
} else {
start.max(new Date(2099, 11, 31));
end.min(new Date(console.log(currentDate)));
}
}
});
}
});

Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy