title: jQuery Timepicker - change the [hourMax] value based on the day selection
body: <p>I'm quite new to javascript and jQuery.</p>
  
  <p>What I have so far works nice but I now need to change the [hourMax] value based on the day selection. Mo-Thu will be 18, Fridays has to be 16 - I suspect the issue could be the function timemax(date).
  Also I need to remove the “Now” button.</p>
  
  <p>How can I do this?
  Your assistance will be appreciated.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
   $(document).ready(function(){
  
  $("#datetimepicker").datetimepicker({
  beforeShowDay: nonWorkingDates,
  numberOfMonths: 1,
  defaultDate: 1,
  firstDay: 0,
  minDate: 0,
  maxDate: '+60D',
  //showAnim: 'slide',
  controlType: 'select',
  timeFormat: 'h:mm tt',
  regional: 'en',
  dateFormat: 'DD, MM d, yy',
  //altField: '#alternate-datime',
  altFormat: 'DD, MM d, yy hh:mm',
  separator: ' @ ',
  showTime:false,
  //timeOnlyTitle: 'Choose Time',
  timeText:'Please select \\n Appointment Time',
  pickerTimeFormat:'h:mm tt',
  currentText:'',
  hourText:'',
  hourMin:9,
  hourMax:timemax,
  //timeFormat: 'hh:mm',
  //separator: 'T',
  showSecond:false,
  showMinute:false,
  //hourMin: '7',
  //hourMax: '13',
  //showSecond: false,
  //hourGrid: 1,
  //minDateTime:9,
  //minuteGrid: 30,
  stepHour: 1,
  //stepMinute: 30,
  //stepSecond: 10
  
  });
  
  function nonWorkingDates(date){
  var day = date.getDay(), Sunday = 0, Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6;
  var closedDates = [
  [1, 1, 2013, 'us'],
        [1, 21, 2013, 'us'],
        [2, 18, 2013, 'us'],
        [3, 29, 2013, 'us'],
        [5, 27, 2013, 'us'],
        [7, 4, 2013, 'us'],
        [9, 2, 2013, 'us'],
        [9, 5, 2013, 'us'],
        [9, 13, 2013, 'us'],
        [10, 14, 2013, 'us'],
        [11, 11, 2013, 'us'],
        [11, 28, 2013, 'us'],
        [11, 29, 2013, 'us'],
        [12, 24, 2013, 'us'],
        [12, 25, 2013, 'us'],
        [12, 31, 2013, 'us']
  ];
  var closedDays = [[Saturday],[Sunday]];
  for (var i = 0; i &lt; closedDays.length; i++) {
  if (day == closedDays[i][0]) {
  return [false];
  }
  
  }
  
  for (i = 0; i &lt; closedDates.length; i++) {
  if (date.getMonth() == closedDates[i][0] - 1 &amp;&amp;
  date.getDate() == closedDates[i][1] &amp;&amp;
  date.getFullYear() == closedDates[i][2]) {
  return [false];
  }
  }
  
  return [true];
  }
  
  function timemax(date){
  var days = date.getDay(), Sunday = 0, Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6;
  
  if(date.getDate() == days[5]){
  return [16];
  }
  else {
  return [18];
  }
  }
  
  });     
          &lt;/script&gt;
  </code></pre>