I have a specific form of datetimepicker, working cool, however, I need every day of the week to have a different time, for example, on Sunday there are 2 available times, the second 3 times, the other another time on Tuesday, how can I do that?
My code is:
$(function() {
$.datetimepicker.setLocale('pt-BR');
$( "#calendario" ).datetimepicker({
theme:'dark',
beforeShowDay: function (date) {
var day = date.getDay();
return [(day != 0)]; //0-Sunday 6-Saturdayreturn [(day != 0];
},
format:'d/m/Y H:i',
allowTimes:['06:00','07:00','08:00','12:30','18:00','19:00','17:20','19:00','20:00'],
minDate: 0,
autoclose: true,
weekStart: 1,
disabledDates:['2015/10/28','2015/11/02','1986/01/10'],
// revalidar caso digite data errada
onSelect: function (calendario, inst) {
$('#calendario').text(this.value);
$('#defaultForm').bootstrapValidator('revalidateField', 'calendario');
}
})
});
<div class="form-group">
<label control-label>Data:</label>
<div class="controls">
<div class="input-group">
<input id="calendario" type="text" class="date-picker form-control" name="calendario" placeholder="Data do agendamento" disabled/>
<label for="calendario" class="input-group-addon btn"><span class="glyphicon glyphicon-calendar"></span></label>
</div>
</div>
</div>