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

397
Views
Datepicker Enable Specific Days from list

I am trying to develop an appointment system. I tried to enable available dates in a date picker, but the problem is that it enables only one day.

$('#doctor').on('change', function() {
  var drId = this.value;
  $('#timetable').html('');
  
  $.ajax({
    url: '{{ route('
    getTimes ') }}?dr_id=' + drId,
    type: 'get',
    success: function(res) {
      console.log(res);
      
      $('#timetable').html('<option value="">Select Day Time</option>');
      
      $.each(res, function(key, value) {
        const weekday = [, "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Satarday"];
        const d = new Date();

        //Disabled by Day Name
        $(document).ready(function() {
          $('#datepicker').datepicker({
            beforeShowDay: filterDays
          });
        });

        // getDay() method returns the day of the week (from 0 to 6) where 
        // Sunday is 0, Monday is 1, and so on.
        function filterDays(date) {
          var day = date.getDay();
          //return true only if day is Wed or Fri or Sun
          return [day[value.day_name]]
        }

        $('#timetable').append('<option value="' + value.id + '">' + value.start_time + value.end_time + '</option>');
      });
    }
  });
});

Here return [day[value.day_name]] shows only Sunday, but there is another 3 days had stored in the database. It's passes only a single value.

Please help me to do this.

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!