Checkin date inferior to Checkout date

Home Forums Quform WordPress Checkin date inferior to Checkout date

This topic is: resolved
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #35449
    azoreslab
    Participant

    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.

    Date validation

    This is the form I’m using:

    BOOKING

    Can you help me with this?

    Best regards

    #35455
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #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)));
    }
    }
    });
    }
    });

    #35464
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy