corrected rounding issue so that UI will always show hours/mins (3:32 hrs) to two dp.

#43
This commit is contained in:
chris.watts90@outlook.com 2017-02-23 20:54:46 +00:00
parent 4025663db9
commit ded664cdd0

View File

@ -134,7 +134,7 @@
if (hrs < 1) { if (hrs < 1) {
return value + " mins"; return value + " mins";
} }
return (value / 60)+" hrs"; return self.round(hrs, 2)+" hrs";
}; };
self.convertToDisplayTime = function (dateValue) { self.convertToDisplayTime = function (dateValue) {
var date = new Date(dateValue); var date = new Date(dateValue);
@ -146,6 +146,9 @@
} }
return logCount; return logCount;
} }
self.round = function (value, decimals) {
return parseFloat(Math.round(value * 100) / 100).toFixed(decimals);
}
self.getTimeLogEntryArrayLength = function(maxDailyLogs) { self.getTimeLogEntryArrayLength = function(maxDailyLogs) {
return Math.round(maxDailyLogs/2); return Math.round(maxDailyLogs/2);
}; };