Fix calendar rounding (#2457)

Signed-off-by: Denis Maslennikov <denis.maslennikov@gmail.com>
This commit is contained in:
Denis Maslennikov 2022-12-21 13:06:04 +07:00 committed by GitHub
parent 6a8fbb65ba
commit 2930c51fa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,6 +23,7 @@
day as getDay,
daysInMonth,
eventToHTMLElement,
floorFractionDigits,
getWeekDayName,
isWeekend,
Label,
@ -113,9 +114,12 @@
function findReports (employee: Employee, date: Date, timeReports: Map<Ref<Employee>, EmployeeReports>): number {
const wday = date.getDate()
return (timeReports.get(employee._id)?.reports ?? [])
.filter((it) => new Date(it.date ?? 0).getDate() === wday)
.reduce((a, b) => a + b.value, 0)
return floorFractionDigits(
(timeReports.get(employee._id)?.reports ?? [])
.filter((it) => new Date(it.date ?? 0).getDate() === wday)
.reduce((a, b) => a + b.value, 0),
3
)
}
</script>