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

313
Views
How to disable specific hours in specific dates in jquery datetimepicker (xdan)?

I'm using jQuery DateTimePicker. I want to disable some specific hours in some specific dates. For example, I want to disable 09:00AM on 29/03/2022 and 10:00AM on 30/03/2022.

I already found this code, but it doesn't work. The inline calendar is running correctly.

var specificDates = ['29/03/2022', '30/03/2022'];
var hoursToTakeAway = [
  [09, 10],
  [10]
];

onGenerate: function(ct, $i) {
  var ind = specificDates.indexOf(ct.dateFormat('d/m/Y'));
  $('.xdsoft_time_variant .xdsoft_time').show();
  if (ind !== -1) {
    $('.xdsoft_time_variant .xdsoft_time').each(function(index) {
      if (hoursToTakeAway[ind].indexOf(parseInt($(this).text())) !== -1) {
        $(this).hide();
      }
    });
  }
}

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

FINAL CODE IS WORKING : ( i'm using momentjs to use moment function on ct)

onGenerate: function(ct,$i) {
    var ind = specificDates.indexOf(moment(ct).format('DD/MM/YYYY'));
    $('.xdsoft_time_variant .xdsoft_time').show();

    if(ind !== -1) {
        $('.xdsoft_time_variant .xdsoft_time').each(function(index){
            if(hoursToTakeAway[ind].indexOf(parseInt($(this).text())) !== -1) {
                $(this).addClass('xdsoft_disabled');
            }
        });
    }
}
about 4 years ago · Juan Pablo Isaza Report
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!