I have the following code that is to add the hours & minutes in a field.
This code works however I get the error NaN:NaN in the totals field if I enter any time with no minutes under 24:00. so if I enter 23:00, 22:00, 01:00 then I get this error. If I enter 24:00, 25:00 + it works?
This code works however I get the error NaN:NaN in the totals field if I enter any time with no minutes under 24:00. so if I enter 23:00, 22:00, 01:00 then I get this error. If I enter 24:00, 25:00 + it works?
Code:
var mins = new Array()
var minsTotal = 0;
if (Row2.Monday.rawValue != null){
mins = Row2.Monday.rawValue.split(":")
minsTotal += parseInt((parseInt(mins[0]) * 60) + parseInt(mins[1]))
}
if (Row3.Tuesday.rawValue != null){
mins = Row3.Tuesday.rawValue.split(":")
minsTotal += parseInt((parseInt(mins[0]) * 60) + parseInt(mins[1]))
}
if (Row4.Wednesday.rawValue != null){
mins = Row4.Wednesday.rawValue.split(":")
minsTotal += parseInt((parseInt(mins[0]) * 60) + parseInt(mins[1]))
}
if (Row5.Thursday.rawValue != null){
mins = Row5.Thursday.rawValue.split(":")
minsTotal += parseInt((parseInt(mins[0]) * 60) + parseInt(mins[1]))
}
if (Row6.Friday.rawValue != null){
mins = Row6.Friday.rawValue.split(":")
minsTotal += parseInt((parseInt(mins[0]) * 60) + parseInt(mins[1]))
}
this.rawValue = parseInt(minsTotal/60) + ":" + parseInt(minsTotal%60);