Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap datetime picker option to select from every half hour

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).

like image 624
I Badarau Avatar asked Dec 15 '22 10:12

I Badarau


2 Answers

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

like image 79
VincenzoC Avatar answered Dec 29 '22 10:12

VincenzoC


For me it works:-

$('.datetimepicker').datetimepicker({ autoclose:true, minuteStep: 30, hoursDisabled: [19, 20, 21, 22, 23, 00, 1, 2, 3, 4, 5, 6, 7] });

like image 24
Rakesh Yadav Avatar answered Dec 29 '22 11:12

Rakesh Yadav