Basically, this script subtracts StartTime from EndTime using the jQuery plugin, the html form is filled in with the start and end time in the HH: MM format, the input field is filled with the result, it works, except for one problem
If the start time is between 08:00 and 09:59, it simply returns strange results - 10 hours results to be exact, why?
All other inputs are calculated correctly!
function setValue() { var startTime = document.getElementById('ToilA'); var endTime = document.getElementById('EndHours'); startTime = startTime.value.split(":"); var startHour = parseInt(startTime[0]); var startMinutes = parseInt(startTime[1]); endTime = endTime.value.split(":"); var endHour = parseInt(endTime[0]); var endMinutes = parseInt(endTime[1]);
source share