Is there a way to make bootstrap datetime picker to show me only options that represent intervals of half hour? (8:00; 8:30; 9:00; 9:30; ...)
Also I would like to know if there are ways to limit time intervals (say start from 8:00 AM until 18:00 PM).
You can set interval with the stepping
parameter, while you can use enabledHours
to limit valid hours of day. Assuming that "datetimepicker" is the id of your component, you can initialize it as follows:
$('#datetimepicker').datetimepicker({
stepping: 30,
enabledHours: [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]
});
You can find further information in the official documentation of the library
For me it works:-
$('.datetimepicker').datetimepicker({
autoclose:true,
minuteStep: 30,
hoursDisabled: [19, 20, 21, 22, 23, 00, 1, 2, 3, 4, 5, 6, 7]
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With