Time Calculation with break (Day and Night Shift) in 24hr format
I have a timesheet where I need to calculate times for day and night shift workers (with breaks) in 24hr time.
I can get the day shift hours to calculate fine however the I cannot get the night shift hours to calculate correctly.
Below is a screen shot of the fields and the field names along with the script I am currently using on the top line (I have used the same script on the second line but changed the field names to match i.e 8.1.0 instead of 8.0.0).

var start = this.getField("8.0.0").value;
var finish = this.getField("11.0.0").value;
if (start=="" || finish=="") event.value = "";
else {
var lunchout = this.getField("9.0.0").value;
var lunchin = this.getField("10.0.0").value;
var startArr = start.split(":");
var finishArr = finish.split(":");
var hourWDiff = Math.abs(finishArr[0] - startArr[0]);
var minWDiff = (Math.abs(finishArr[1] - startArr[1])/60*100);
var hourLDiff = 0;
var minLDiff = 0;
if (lunchout!="" && lunchin!="") {
var lunchoutArr = lunchout.split(":");
var lunchinArr = lunchin.split(":");
hourLDiff = Math.abs(lunchoutArr[0] - lunchinArr[0]);
minLDiff = (Math.abs(lunchoutArr[1] - lunchinArr[1])/60*100);
}
var totalHrs = hourWDiff + (minWDiff/100) - (hourLDiff + (minLDiff/100));
event.value = totalHrs;
}
