diff --git a/plugins/hr-resources/src/components/ScheduleView.svelte b/plugins/hr-resources/src/components/ScheduleView.svelte index d1a70179fa..146f47fc9a 100644 --- a/plugins/hr-resources/src/components/ScheduleView.svelte +++ b/plugins/hr-resources/src/components/ScheduleView.svelte @@ -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) => { diff --git a/plugins/hr-resources/src/utils.ts b/plugins/hr-resources/src/utils.ts index 8501ea7629..cab77d95bf 100644 --- a/plugins/hr-resources/src/utils.ts +++ b/plugins/hr-resources/src/utils.ts @@ -105,7 +105,7 @@ export function getRequestDays (request: Request, types: Map, 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()