1// link for issue
2// https://github.com/Eonasdan/bootstrap-datetimepicker/issues/2077
3
4//1 - Create these functions in a custom (DatePicker) namespace.
5DatePicker = {
6 hideOldDays: function(){ // hide days for previous month
7 var x = $('.datepicker .datepicker-days tr td.old');
8 if(x.length > 0){
9 x.css('visibility', 'hidden');
10 if(x.length === 7){
11 x.parent().hide();
12 }
13 }
14 },
15 hideNewDays: function(){ // hide days for next month
16 var x = $('.datepicker .datepicker-days tr td.new');
17 if(x.length > 0){
18 x.hide();
19 }
20 },
21 hideOtherMonthDays: function(){ // hide days not for current month
22 DatePicker.hideOldDays();
23 DatePicker.hideNewDays();
24 }
25 };
26
27//2 - Add this event for datePicker
28$('.datepicker').datepicker().on('show', function(e) {
29 DatePicker.hideOtherMonthDays();
30 });