'Daterangepicker: How to stop start and end date from being the same when a date is selected?

I am using JQuery's daterangepicker plugin on my website to enable users to select check-in and check-out dates for booking a room. I have made sure that the user cannot select any date that has already passed but my issue is when the user selects a particular date as their check in date, they would be able to select that same date again as their checkout date and this is what I want to avoid them doing. For example if they select 14th March 2022 as their check in date, they would be able to select 14th March 2022 again as their checkout date.

Here is a what I have done to try make this work:

$(".checkin").daterangepicker({
    autoApply: true,
    alwaysShowCalendars: true,
    formatDate: 'MM/DD/YYYY', // Format i chose for setting how date should look
    startDate: moment(), // I set the starting date to be the current date
    endDate: moment().add(1, 'days'), // I set the no of days not to exceed 1 day but it made only the current day selectable
    minDate: moment(),
    maxDate: moment().add(1, "days"),
    clickDate(): function(e) { // I saw this method in the daterangepicker object but it didn't work
        console.log("Specified date clicked");
    }
});

Who can help me out with this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source