Fixed issue #418 - Max times for escalation 99 hours.

This commit is contained in:
Martin Edenhofer 2016-12-14 00:16:03 +01:00
parent c3f338db02
commit a1e19cc75d
2 changed files with 23 additions and 8 deletions

View file

@ -485,13 +485,21 @@
}, },
highlightHour: function() { highlightHour: function() {
var time = this.$element.val(),
timeArray = time.replace(/[^0-9\:]/g, '').split(':'),
hour = timeArray[0] ? timeArray[0].toString() : timeArray.toString(),
hour_max_length = hour.toString().length
this.highlightedUnit = 'hour'; this.highlightedUnit = 'hour';
this.setSelectionRange(0, 2); this.setSelectionRange(0, hour_max_length);
}, },
highlightMinute: function() { highlightMinute: function() {
var time = this.$element.val(),
timeArray = time.replace(/[^0-9\:]/g, '').split(':'),
hour = timeArray[0] ? timeArray[0].toString() : timeArray.toString(),
hour_max_length = hour.toString().length
this.highlightedUnit = 'minute'; this.highlightedUnit = 'minute';
this.setSelectionRange(3, 5); this.setSelectionRange(hour_max_length+1, hour_max_length+3);
}, },
highlightSecond: function() { highlightSecond: function() {
@ -790,7 +798,8 @@
hour = timeArray[0] ? timeArray[0].toString() : timeArray.toString(); hour = timeArray[0] ? timeArray[0].toString() : timeArray.toString();
if(this.explicitMode && hour.length > 2 && (hour.length % 2) !== 0 ) { var hour_max_length = this.maxHours.toString().length
if(this.explicitMode && hour.length > hour_max_length && (hour.length % 2) !== 0 ) {
this.clear(); this.clear();
return; return;
} }
@ -804,9 +813,9 @@
hour = hour.slice(0, -2); hour = hour.slice(0, -2);
} }
if (hour.length > 2) { if (hour.length > hour_max_length) {
minute = hour.slice(-2); minute = hour.slice(-hour_max_length);
hour = hour.slice(0, -2); hour = hour.slice(0, -hour_max_length);
} }
if (minute.length > 2) { if (minute.length > 2) {
@ -840,7 +849,7 @@
if (hour > this.maxHours) { if (hour > this.maxHours) {
// No day/date handling. // No day/date handling.
hour = this.maxHours - 1; hour = this.maxHours;
} }
if (this.showMeridian) { if (this.showMeridian) {

View file

@ -1594,7 +1594,6 @@ input[type=time] {
input.timeframe, input.timeframe,
input.time { input.time {
width: 4.5ch;
box-sizing: content-box; box-sizing: content-box;
padding: 0 6px; padding: 0 6px;
line-height: 42px; line-height: 42px;
@ -1605,6 +1604,13 @@ input.time {
} }
} }
input.timeframe {
width: 5.5ch;
}
input.time {
width: 4.5ch;
}
input.time.time--12 { input.time.time--12 {
width: 7.5ch; width: 7.5ch;
} }