Litepicker icon indicating copy to clipboard operation
Litepicker copied to clipboard

If day before lockedDay is available, allow lockedDay as date2

Open tyekynan opened this issue 4 years ago • 0 comments

var lockedDates = [];
  for(var i = 0, len = response.length; i < len; i++){ 
    let lockDate = response[i].staydate;
    lockedDates.push(lockDate);
  }

  let input = document.getElementById(response[0].room + '-availabledates');
      const picker = new Litepicker ({
        singleMode: false,
        inlineMode: true,
        numberOfMonths: 2,
        numberOfColumns: 2,
        format: "MM-DD-YYYY",
        element: input,
        lockDays: lockedDates,
        disallowLockDaysInRange: true,
        setup: function (picker) {
          picker.on('selected', function (date1, date2) {
            document.getElementById(response[0].room + '-chosendates').innerHTML = '<span>Check-In: ' + date1.format('MM-DD-YYYY') + '&nbsp;&nbsp;&nbsp;&nbsp;Check-Out: ' + date2.format('MM-DD-YYYY' + '</span>');
          }) 
      }
      })
    }

I am new to coding and VERY new to litepicker. I have googled around a bit and can't seem to find many good examples for this issue.
If a day is locked, and the day before it is available. How can I allow that particular locked date to be date2. Without allowing it to be selected within a range or as date1. Reading through the documentation on the site, it seems there used to be a hotelMode, and that seems to be exactly what I am looking for.

tyekynan avatar Sep 15 '21 01:09 tyekynan