disable specific date in bootstrap datepicker code example

Example: bootstrap-datepicker disable dates from another month

// link for issue
// https://github.com/Eonasdan/bootstrap-datetimepicker/issues/2077

//1 - Create these functions in a custom (DatePicker) namespace.
DatePicker = {
        hideOldDays: function(){ // hide days for previous month
            var x = $('.datepicker .datepicker-days tr td.old');
            if(x.length > 0){
                x.css('visibility', 'hidden');
                if(x.length === 7){
                    x.parent().hide();
                }
            }
        },
        hideNewDays: function(){ // hide days for next month
            var x = $('.datepicker .datepicker-days tr td.new');
            if(x.length > 0){
                x.hide();
            }
        },
        hideOtherMonthDays: function(){ // hide days not for current month
            DatePicker.hideOldDays();
            DatePicker.hideNewDays();
        }
    };
    
//2 - Add this event for datePicker
$('.datepicker').datepicker().on('show', function(e) {
        DatePicker.hideOtherMonthDays();
    });