1
I have a specific form of datetimepicker, working cool, however, I need each day of the week to have a different time, for example, on Sunday have 2 times available, on Monday 3 times, on Tuesday another time, how can I do this?
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>
Bro, this is exactly what I needed, I searched everywhere and couldn’t find, vlw!
– Rubens Junior
@Rubensjunior, just next time remember to inform which plugin you are using, luckily I use it in my projects and managed to identify that it was him.
– Tobias Mesquita