Search code examples
javascriptdatetimepickerdisable

Disabling specific hour on a select day on Bootstrap Datetimepicker


I am creating a booking system that reserves down to the hour slot using this datetimepicker : https://eonasdan.github.io/bootstrap-datetimepicker/

I am in the process of disabling hours that are already booked but I cannot seem to find the way to do it. In the options, disabling hours just disables those hours for every single day and disable date just disables that date completely.

What I need is: If 06/30/2020 5:00pm is booked, it should be disabled but there is no option to do that. Does anyone have an idea on how to attack this? or is there a datetimepicker with that options?

Thanks.


Solution

  • According to the documentation you can implement it like this ->

    Documentation

    options = {disabledTimeIntervals: [[moment({ h: 0 }), moment({ h: 8 })], [moment({ h: 
    18 }), moment({ h: 24 })]] }
    

    EDIT

    Moment Documentation