Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap DateTimePicker set hour (09:00 - 20:00)

I'm using smalot/bootstrap-datetimepicker

How can I set the range of the hour from 09:00 to 20:00 or disable the other hour.

I found the trentrichardson/jQuery-Timepicker-Addon can set the hourmax and hourmin, but how can i do in the bootstrap-datetimepicker?

like image 476
JY HO Avatar asked Mar 25 '26 13:03

JY HO


1 Answers

As of now, this is not possible using smalot's datetimepicker.

However, this is possible with eonasdan's (closely related) datetimepicker. With eonasdan's plugin, you would use the parameter en/disabledHours:

$("#myPicker").datetimepicker({
    disabledHours: [0, 1, 2, 3, 4, 5, 6, 7, 8, 21, 22, 23, 24];
});
like image 151
Jean-Paul Avatar answered Mar 27 '26 03:03

Jean-Paul



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!