evanx
evanx

Reputation: 1301

timePicker, how to suppress hours within a range?

I'm using Time datePicker which is great!

$(function() {
    $("#appointment_atime").timepicker({
        'minTime': '9:00pm',
        'maxTime': '6:00pm',

    });

Is there a way to suppress or hide some hours within that range?

I don't want 12am and 1pm appears as options.

Is that possible?

Upvotes: 0

Views: 2589

Answers (1)

j08691
j08691

Reputation: 207900

Since this plugin seems to have no callback to signal the generation of the times, you'll need to create a function that runs through the list to remove the unwanted entries when the list is clicked on.

Try this jsFiddle example that removes 12am and 1pm.

$('#basicExample').timepicker({
    'minTime': '9:00pm',
    'maxTime': '6:00pm',
    'step': 60
});
$('#basicExample').on('showTimepicker', function () {
  $('.ui-timepicker-list li').filter(function (index) {
      return ($(this).text() == '12:00am' || $(this).text() == '1:00pm');
  }).remove();
});

Upvotes: 2

Related Questions