benitolopez / hotel-datepicker

Date range picker for hotels
https://hoteldatepicker.org
MIT License
311 stars 98 forks source link

How to turn-off the one day notice for check-in on the same day as someone's else check-out? #154

Closed 3nematix closed 1 year ago

3nematix commented 1 year ago

Let's say that someone has booked their apartment from 2023-01-19 to 2023-01-21 and someone wants to book their apartment from the day that the these people will check-out (2023-01-21). As we can see in the photo below if the new check-out date would be 2021-01-23 (day before other people reservation) these people would be able to check-out, but is there any way to check-out on the same-day as other people has their check-in? For example their new check-in would be on the same day but let's say at around 3-7 PM so the people that had their check-out they would be already gone at around 11-12 AM or etc..

Is there any way to disable "One-day notice" or how is it called?:)

In this example I can only check-out at 2021-01-23, but can't at 24. image

Thanks!

3nematix commented 1 year ago

image

3nematix commented 1 year ago

When using enableCheckout: true this weird logic appears, it now let's to check-out on the first check-in date of others, but also allows the second day.

My suggestion is to use date format with time? So then people can provide their check-in date with time and then we can compare the both times if it would fit in the range of check-in out times

image

https://i.gyazo.com/e9033419c615f91e39e088d9059ddf8e.mp4

3nematix commented 1 year ago
            const booking_date_calendar = document.getElementById('dates');

            if (booking_date_calendar) {
                const disabled_dates = window.page_data.booking_dates.disabled_dates || [];
                const no_check_in_dates = window.page_data.booking_dates.no_check_in_dates || [];
                const no_check_out_dates = window.page_data.booking_dates.no_check_out_dates || [];

                var datepicker = new window.hotelDatepicker(booking_date_calendar, {
                    minNights: 1,
                    clearButton: true,
                    autoClose: false,
                    enableCheckout: true,
                    selectForward: true,
                    preventContainerClose: true,
                    disabledDates: disabled_dates,
                    noCheckInDates: no_check_in_dates,
                    noCheckOutDates: no_check_out_dates,
                });
            }

image

3nematix commented 1 year ago

if we would change datepicker__month-day--invalid -> datepicker__month-day--valid we would be able to check-out at that day

<td daytype="visibleMonth" time="1674511200000" d="3" role="button" index="24" aria-label="Not available, Tuesday, January 24, 2023" aria-disabled="true" class="datepicker__month-day datepicker__month-day--visibleMonth datepicker__month-day--invalid      datepicker__month-day--no-checkin ">24</td>
3nematix commented 1 year ago

Very strange, in this screenshot I can book from 19-20 day but 23-24 is not possible (20, 24 days are check-in dates)

image

benitolopez commented 1 year ago

Ok, it seems the issue is that disabled dates are selectable if they come after a noCheckInDates date. Right?

By the way, I can book dates from 23 to 24 with your same config.

PS. Dates with time are not planned at all at the moment.

3nematix commented 1 year ago

Not really, the issue in this case is that It's not possible to select check-out on someones else check-in date. Please test it with multiple reservations active.

3nematix commented 1 year ago

And also how do you mark one night stand? I guess it should be noCheckIndates = [2023-01-19] noCheckOutDates = [2023-01-20] and no disabled dates? I've created an algorithm from BE which gets the range between check-in and check-out dates and fill it with disabled dates,.

So for 2 nights stay the config would be: noCheckIndates = [2023-01-19] noCheckOutDates = [2023-01-21] disabled=[2023-01-20]

benitolopez commented 1 year ago

As explained here you misunderstood the meaning of the noCheckInDates and noCheckOutDates options.

So please adapt your code with the correct configuration and then let me know if the issue persists: