Timesheet help
Hi All
I'm trying to create an auto calculated timesheet and I got it to work if the input time starts and end on the same day using this code:
var start = this.getField("Start Time").value;
var startArr = start.split(":");
var finish = this.getField("Stop Time").value;
var finishArr = finish.split(":");
var hourDiff = Math.abs(finishArr[0] - startArr[0]);
var minDiff = Math.floor((Math.abs(finishArr[1] - startArr[1]) / 60)*100);
if (minDiff.toString().length == 1)
minDiff = '0' + minDiff;
var output = hourDiff + "." + minDiff;
event.value = output;
I ran into a problem where if the Stop Time happens the next day (or 3 days later, etc) how do I go about calculating that?
