I have a validation function which compares two values, startsecs and endsecs. If startsecs is greater than endsecs, an error should be displayed, but it's not working because the if statement is evaluating as true, when it should be false.
You can see this by going to uncheck the box that says 'this event last all day', then enter 12:00 as the start time and 17:00 as the end time, and click save. Evevn in the error that's displayed, the second value is greater than the first, so it should evaluate as false.
The function can be seen as on line 223.
You can see this by going to uncheck the box that says 'this event last all day', then enter 12:00 as the start time and 17:00 as the end time, and click save. Evevn in the error that's displayed, the second value is greater than the first, so it should evaluate as false.
The function can be seen as on line 223.
Code:
var startsecs = (document.getElementById('starthour').value * 60) + document.getElementById('startminute').value;
var endsecs = (document.getElementById('endhour').value * 60) + document.getElementById('endminute').value;
if(startsecs > endsecs) {
document.getElementById('error_end').innerHTML = 'End time must be after start time:'+endsecs+'::'+startsecs;
document.getElementById('error_end').style.display = 'block';
valid = false;
}