From 4479c65796401d61331afbbba33774f409c525fa Mon Sep 17 00:00:00 2001 From: Denis Maslennikov <41147528+disant1@users.noreply.github.com> Date: Thu, 22 Dec 2022 10:46:16 +0700 Subject: [PATCH] Fix calendar year view (#2464) Signed-off-by: Denis Maslennikov --- plugins/hr-resources/src/components/ScheduleView.svelte | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/hr-resources/src/components/ScheduleView.svelte b/plugins/hr-resources/src/components/ScheduleView.svelte index b2fe06ad58..652dad8aee 100644 --- a/plugins/hr-resources/src/components/ScheduleView.svelte +++ b/plugins/hr-resources/src/components/ScheduleView.svelte @@ -32,12 +32,12 @@ export let display: 'chart' | 'stats' $: startDate = new Date( - new Date(mode === CalendarMode.Year ? new Date(currentDate).setMonth(1) : currentDate).setDate(1) + new Date(mode === CalendarMode.Year ? new Date(currentDate).setMonth(0) : currentDate).setDate(1) ) $: endDate = new Date( mode === CalendarMode.Year - ? 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) + ? new Date(new Date(startDate).setFullYear(new Date(startDate).getFullYear() + 1)).setDate(0) + : new Date(new Date(startDate).setMonth(new Date(startDate).getMonth() + 1)).setDate(0) ) $: departments = [department, ...getDescendants(department, descendants)]