Skip to content

Commit 34c96ed

Browse files
author
Robert Strouse
committed
Fix issue with time array when empty #809
1 parent f688448 commit 34c96ed

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

scripts/widgets.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,15 +1420,17 @@ $.ui.position.fieldTip = {
14201420
else if (stripped.length === 2) arr = [stripped, '0'];
14211421
else if (stripped.length === 3) arr = [stripped.substring(0, 1), stripped.substring(1)];
14221422
else if (stripped.length > 2) arr = [stripped.substring(0, 1), stripped.substring(2)];
1423-
if (arr.length > 0) {
1424-
hrs = parseInt(arr[0].replace(/\D/g), 10);
1425-
//bAddHrs = (indexOfAny(arr[0], ['P', 'p']) !== -1);
1426-
if (hrs === 12 && !bAddHrs) hrs = 0;
1427-
}
1428-
if (arr.length > 1) {
1429-
mins = parseInt(arr[1].replace(/\D/g), 10);
1430-
//bAddHrs = (indexOfAny(arr[1], ['P', 'p']) !== -1);
1431-
//if (hrs === 12 && !bAddHrs) hrs = 0;
1423+
if (typeof arr !== 'undefined') {
1424+
if (arr.length > 0) {
1425+
hrs = parseInt(arr[0].replace(/\D/g), 10);
1426+
//bAddHrs = (indexOfAny(arr[0], ['P', 'p']) !== -1);
1427+
if (hrs === 12 && !bAddHrs) hrs = 0;
1428+
}
1429+
if (arr.length > 1) {
1430+
mins = parseInt(arr[1].replace(/\D/g), 10);
1431+
//bAddHrs = (indexOfAny(arr[1], ['P', 'p']) !== -1);
1432+
//if (hrs === 12 && !bAddHrs) hrs = 0;
1433+
}
14321434
}
14331435
if (isNaN(hrs)) hrs = 0;
14341436
if (isNaN(mins)) mins = 0;

0 commit comments

Comments
 (0)