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

109
Views
Datepicker ui - check if dates from/to overlapping disabled days

I have 2 datepickers - date from and date to, something like hotel reservation system. How do I check (and show hidden div.error) if there are some disabled days in selected period?

Ex. - selected dates - from 2021-12-20 to 2021-12-31; disabled days are ["2021-12-25", "2021-12-26"] -> show "error".

<div class="error" style="display:none">Sorry, but we have no available rooms in selected dates.</div>

<script>
$( function() {
                var disableddates = ["2021-12-25", "2021-12-26"];
                
                $.datepicker.setDefaults($.datepicker.regional["de"]);
                $( "#from" ).datepicker({          
                beforeShowDay: function(date){
                    var string = jQuery.datepicker.formatDate("yy-mm-dd", date);
                    return [ disableddates.indexOf(string) == -1 ]
                    }
                });
                
                $( "#to" ).datepicker({     
                beforeShowDay: function(date){
                    var string = jQuery.datepicker.formatDate("yy-mm-dd", date);
                    return [disableddates.indexOf(string) == -1 ]
                    }
                });
            });
</script>
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!