Skip to content

Commit

Permalink
added 'value' option for setting value of timepicker to value of element
Browse files Browse the repository at this point in the history
  • Loading branch information
koenpunt committed May 9, 2012
1 parent 37ee91f commit af8619f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion js/bootstrap-timepicker.js
Expand Up @@ -117,6 +117,7 @@
if (match) {
meridian = match[1];
}
// .split(/^([0-9]+):([0-9]+) (AM|PM)$/)
time = $.trim(time.replace(/(PM|AM)/i, ''));
var timeArray = time.split(':');

Expand All @@ -132,7 +133,7 @@
var hours = dTime.getHours();
var minutes = Math.floor(dTime.getMinutes() / this.minuteStep) * this.minuteStep;
var meridian = "AM";
if ( this.showMeridian ){
if ( this.showMeridian ) {
if (hours === 0) {
hours = 12;
} else if (hours > 12) {
Expand All @@ -145,6 +146,8 @@
this.hour = hours;
this.minute = minutes;
this.meridian = meridian;
} else if (defaultTime === 'value') {
this.setValues( this.$element.val() );
} else {
this.setValues(defaultTime);
}
Expand Down

0 comments on commit af8619f

Please sign in to comment.