Home › Forums › Quform WordPress › Checkin date inferior to Checkout date
- This topic has 3 replies, 2 voices, and was last updated 1 year, 5 months ago by Ally.
- AuthorPosts
- April 27, 2023 at 6:49 pm #35449azoreslabParticipant
Hi
I’m trying to make checkout date is always later than checkin date.
I followed this guide, but it is not working for me.This is the form I’m using:
Can you help me with this?
Best regards
May 1, 2023 at 11:00 am #35455AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
May 2, 2023 at 7:05 pm #35463azoreslabParticipantHi
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)));
}
}
});
}
});May 3, 2023 at 9:33 am #35464AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.