I'm trying to create a form to submit missing pay. I've figured out how to subtract the start time from the end time (even if the end time is PM and the start time is AM) then convert the time to decimal. But I've got a drop-down that should subtract 30 minutes for meal break and I can't figure out the javascript to do it.
I think it has something to do with having multiple event.value statments?
Here's the form:

Here's the code (underlined is code that's not working):
//to calculate total time
var startTimeString = this.getField("TimeIn1").valueAsString;
var endTimeString = this.getField("TimeOut1").valueAsString;
var startHour=startTimeString.split(":")[0];
var startMin=startTimeString.split(":")[1];
var endHour=endTimeString.split(":")[0];
var endMin=endTimeString.split(":")[1];
if (Number(startHour) > Number(endHour)) {
event.value = (60 * (startHour-endHour)) + (startMin-endMin);
}
else {
event.value = (60*(endHour-startHour)) + (endMin-startMin);
}
// to subtract mealBreak
var mealBreak = this.getField("Y/N1");
if (mealBreak = "Y" || mealBreak = "") { event.value = event.value-30; }
else { event.value; }
//to convert to decimal hours
event.value=event.value/60