Fix calendar year view (#2464)

Signed-off-by: Denis Maslennikov <denis.maslennikov@gmail.com>
This commit is contained in:
Denis Maslennikov 2022-12-22 10:46:16 +07:00 committed by GitHub
parent 625dff381d
commit 4479c65796
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,12 +32,12 @@
export let display: 'chart' | 'stats' export let display: 'chart' | 'stats'
$: startDate = new Date( $: 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( $: endDate = new Date(
mode === CalendarMode.Year mode === CalendarMode.Year
? new Date(new Date(startDate).setFullYear(new Date(startDate).getFullYear() + 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(-1) : new Date(new Date(startDate).setMonth(new Date(startDate).getMonth() + 1)).setDate(0)
) )
$: departments = [department, ...getDescendants(department, descendants)] $: departments = [department, ...getDescendants(department, descendants)]