Remove NAN:NAN time between cells
Hi
I have a custom Java code to caluclate times between Take Off & landing. Format in HH:MM, format out should be HH:MM. However, the result is displaying NaN:NaN which is annoying until you enter times. Here is my code: Seems to work, just the NaN is annoying whilst the cells are blank.
var hrsStart = parseInt(this.getField("Take Off Z1").value.split(":")[0]);
var minStart = parseInt(this.getField("Take Off Z1").value.split(":")[1]);
var hrsEnd = parseInt(this.getField("Landing Z1").value.split(":")[0]);
var minEnd = parseInt(this.getField("Landing Z1").value.split(":")[1]);
if (minStart > minEnd) {
var minRez = 60 + minEnd - minStart;
var hrsRez = hrsEnd - 1 - hrsStart;
} else {
var minRez = minEnd - minStart;
var hrsRez = hrsEnd - hrsStart;
}
this.getField("Flight Time1").value = hrsRez + ":" + minRez;