Skip to content

Commit

Permalink
尝试修复 jdewit#313
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyo837 committed Mar 30, 2018
1 parent ec70955 commit 6de1da8
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions js/bootstrap-timepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,21 @@
if (step) {
newVal = this.minute - step;
} else {
newVal = this.minute - this.minuteStep;
var minuteStep = this.minuteStep;
if (this.minuteStep > 60) {
var hourStep = Math.floor(this.minuteStep / 60);
minuteStep -= (hourStep * 60);
if (minuteStep === 0) {
minuteStep = 60;
}

var decrementHours = hourStep - (minuteStep == 60 ? 1 : 0);
for (var i = 0; i < decrementHours; i++) {
this.decrementHour();
}
}

newVal = this.minute - minuteStep;
}

if (newVal < 0) {
Expand Down Expand Up @@ -559,7 +573,21 @@
if (step) {
newVal = this.minute + step;
} else {
newVal = this.minute + this.minuteStep - (this.minute % this.minuteStep);
var minuteStep = this.minuteStep;
if (this.minuteStep > 60) {
var hourStep = Math.floor(this.minuteStep / 60);
minuteStep -= (hourStep * 60);
if (minuteStep === 0) {
minuteStep = 60;
}

var incrementHours = hourStep - (minuteStep == 60 ? 1 : 0);
for (var i = 0; i < incrementHours; i++) {
this.incrementHour();
}
}

newVal = this.minute + minuteStep - (this.minute % minuteStep);
}

if (newVal > 59) {
Expand Down

0 comments on commit 6de1da8

Please sign in to comment.