Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

143
Views
hotel-datepicker set default date

I am using this datepicker : https://github.com/benitolopez/hotel-datepicker

My datepicker works fine, however, when creating the calendar I would like it to open on a specific month without disabling previous months as long as it is within my startDate and endDate.

I tried changing the startDate and that works, however, it disables all of the months before (saw that in the documentation after the fact). Which is no bueno. I did some googling and found people using a defaultDate for other datepickers but that doesn't seem to do anything. Any help would be appreciated.

var default_date = document.getElementById("start").value;

let datepicker = new HotelDatepicker(document.getElementById(response[0].room + '-datepicker'), {
    format: 'MM-DD-YYYY',
    infoFormat: 'MM-DD-YYYY',
    minNights: 1,
    maxNights: 29,
    disabledDates: lockedDates,
    noCheckInDates: lockedDates,
    startDate: moment().add(1, 'days').format('MM-DD-YYYY'),
    endDate: maxDay,
    defaultDate: default_date,
    enableCheckout: true,
    autoClose: false,
    preventContainerClose: true,
    moveBothMonths: true,
    selectForward: true,
    setValue: function (s, s1, s2) {
      var checkin = new Date(s1);
      var checkout = new Date(s2);
      var checkin_formatted = fecha.format(checkin, 'YYYY-MM-DD');
      var checkout_formatted = fecha.format(checkout, 'YYYY-MM-DD');

      document.getElementById(response[0].room + '-partialcheckin').value = checkin_formatted;
      document.getElementById(response[0].room + '-partialcheckout').value = checkout_formatted;
    }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!