diff --git a/js/bootstrap-timepicker.js b/js/bootstrap-timepicker.js index c8208bbf..6a734e8e 100644 --- a/js/bootstrap-timepicker.js +++ b/js/bootstrap-timepicker.js @@ -29,7 +29,7 @@ this.template = options.template; this.appendWidgetTo = options.appendWidgetTo; this.showWidgetOnAddonClick = options.showWidgetOnAddonClick; - + this.hourTwoDigits = options.hourTwoDigits; this._init(); }; @@ -323,7 +323,7 @@ return ''; } - return this.hour + ':' + (this.minute.toString().length === 1 ? '0' + this.minute : this.minute) + (this.showSeconds ? ':' + (this.second.toString().length === 1 ? '0' + this.second : this.second) : '') + (this.showMeridian ? ' ' + this.meridian : ''); + return ((this.hour.toString().length === 1 && this.hourTwoDigits)? '0' + this.hour : this.hour) + ':' + (this.minute.toString().length === 1 ? '0' + this.minute : this.minute) + (this.showSeconds ? ':' + (this.second.toString().length === 1 ? '0' + this.second : this.second) : '') + (this.showMeridian ? ' ' + this.meridian : ''); }, hideWidget: function() { @@ -1089,7 +1089,8 @@ showMeridian: true, template: 'dropdown', appendWidgetTo: 'body', - showWidgetOnAddonClick: true + showWidgetOnAddonClick: true, + hourTwoDigits: false, }; $.fn.timepicker.Constructor = Timepicker;