diff --git a/htdocs/core/js/timesheet.js b/htdocs/core/js/timesheet.js index 44180b42acb..3bd93555d76 100644 --- a/htdocs/core/js/timesheet.js +++ b/htdocs/core/js/timesheet.js @@ -222,20 +222,21 @@ function updateTotal(days,mode) else jQuery('.totalDay'+days).removeClass("bold"); jQuery('.totalDay'+days).text(pad(total.getHours())+':'+pad(total.getMinutes())); - var total = new Date(0); - total.setHours(0); - total.setMinutes(0); + var totalhour = 0; + var totalmin = 0; for (var i=0; i<7; i++) { var taskTime= new Date(0); result=parseTime(jQuery('.totalDay'+i).text(),taskTime); if (result >= 0) { - total.setHours(total.getHours()+taskTime.getHours()); - total.setMinutes(total.getMinutes()+taskTime.getMinutes()); + totalhour = totalhour + taskTime.getHours(); + totalmin = totalmin + taskTime.getMinutes(); } } - jQuery('.totalDayAll').text(pad(total.getHours())+':'+pad(total.getMinutes())); + morehours = Math.floor(totalmin / 60); + totalmin = totalmin % 60; + jQuery('.totalDayAll').text(pad(morehours + totalhour)+':'+pad(totalmin)); } else {