I'm having trouble calculating a time (hours:minutes) difference between three time values presented as HH:mm strings.
I'm calculating time worked in a day from time in, lunch time and time out.
e.g. var time_worked = time_out - lunch - time_in or 07:00 = 17:00 - 01:00 - 09:00
I'm familiar with the php dates but the javascript date object is scary!
Code:
var time_in = $(".time-in").val(); // 09:00
var time_out = $(".time-out").val(); // 17:00
var lunch = $(".lunch").val(); // 01:00
var time = time_out - lunch - time_in; // should be 07:00 or 7