Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding hours (time fields in livecycle)

Status
Not open for further replies.

primagic

IS-IT--Management
Jul 24, 2008
476
0
0
GB
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?
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);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top