I have had a good search for what I'm looking for but can't seem to find exactly what I need. I'm new to jQuery and JavaScript.
All I want to do is subtract one 24 hour clock time from another to find how many hours have been allocated using JQuery or JavaScript i.e. start time: 12:00 end time: 16:00 would be 4 hours.
How would I go about doing this without having issues when going from say 12:00 till 12:00 the following day?
I am not dealing with with dates, just time.
Currently the times are stored like this as part of an object with start_time
end_time
:
var shift = {'location':$('#shift_location').val(),
'shift_date': $('#shift_date').val(),
'start_time':$('#shift_start_time').val(),
'end_time':$('#shift_end_time').val()
};
var shift_list = JSON.parse(localStorage.shift);
shift_list.push(shift);
localStorage.shift = JSON.stringify(shift_list);