From 9e5718715efe6d7662d24c5ee2de479452ad3c42 Mon Sep 17 00:00:00 2001 From: Ben Miller Date: Tue, 30 May 2017 17:20:38 -0700 Subject: [PATCH] Added ability to hide disabled hours on hideDisable option --- js/bootstrap-datetimepicker.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/js/bootstrap-datetimepicker.js b/js/bootstrap-datetimepicker.js index f66d69c1..052e0cb1 100644 --- a/js/bootstrap-datetimepicker.js +++ b/js/bootstrap-datetimepicker.js @@ -92,6 +92,7 @@ this.isVisible = false; this.isInput = this.element.is('input'); this.fontAwesome = options.fontAwesome || this.element.data('font-awesome') || false; + this.hideDisabled = options.hideDisabled || false; this.bootcssVer = options.bootcssVer || (this.isInput ? (this.element.is('.form-control') ? 3 : 2) : ( this.bootcssVer = this.element.is('.input-group') ? 3 : 2 )); @@ -814,7 +815,13 @@ } else { classes.push('hour_pm'); } - html.push('' + txt + ''); + if ( this.hideDisabled ) { + if ( $.inArray( 'disabled', classes ) == -1 ){ + html.push('' + txt + ''); + } + } else { + html.push('' + txt + ''); + } if (i === 23) { html.push(''); }