Fix schedule total (#2250)

Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
Denis Bykhov 2022-08-10 12:46:29 +06:00 committed by GitHub
parent 14181885a8
commit 42ba7c0944
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -36,8 +36,8 @@
)
$: endDate = new Date(
mode === CalendarMode.Year
? new Date(startDate).setFullYear(new Date(startDate).getFullYear() + 1)
: new Date(startDate).setMonth(new Date(startDate).getMonth() + 1)
? new Date(new Date(startDate).setFullYear(new Date(startDate).getFullYear() + 1)).setDate(-1)
: new Date(new Date(startDate).setMonth(new Date(startDate).getMonth() + 1)).setDate(-1)
)
$: departments = [department, ...getDescendants(department, descendants)]
@ -84,7 +84,7 @@
'tzDueDate.year': { $gte: startDate.getFullYear() },
'tzDueDate.month': { $gte: startDate.getMonth() },
'tzDate.year': { $lte: endDate.getFullYear() },
'tzDate.month': { $lte: endDate.getFullYear() },
'tzDate.month': { $lte: endDate.getMonth() },
space: { $in: departments }
},
(res) => {

View File

@ -105,7 +105,7 @@ export function getRequestDays (request: Request, types: Map<Ref<RequestType>, R
const endDate =
request.tzDueDate.month === month
? fromTzDate(request.tzDueDate)
: fromTzDate({ ...request.tzDueDate, month: month + 1, day: -1 })
: fromTzDate({ ...request.tzDueDate, month: month + 1, day: 0 })
const days = Math.floor(Math.abs((1 + endDate - startDate) / 1000 / 60 / 60 / 24)) + 1
const stDate = new Date(startDate)
const stDateDate = stDate.getDate()