diff --git a/web/src/lib/components/shared-components/scrollbar/scrollbar.svelte b/web/src/lib/components/shared-components/scrollbar/scrollbar.svelte index 750b3247ba..24490329b4 100644 --- a/web/src/lib/components/shared-components/scrollbar/scrollbar.svelte +++ b/web/src/lib/components/shared-components/scrollbar/scrollbar.svelte @@ -96,6 +96,19 @@ {@const date = fromLocalDateTime(segment.timeGroup)} {@const year = date.year} {@const label = `${date.toLocaleString({ month: 'short' })} ${year}`} + {@const lastGroupYear = fromLocalDateTime(segments[index - 1]?.timeGroup).year} + + + {@const canRenderYear = segments.slice(index + 1, index + 3).reduce((_, curr) => { + const nextGroupYear = fromLocalDateTime(curr.timeGroup).year; + + if (nextGroupYear !== year || curr.height < 1) { + return false; + } + + return true; + }, true)}
(hoverLabel = label)} > - {#if new Date(segments[index - 1]?.timeGroup).getFullYear() !== year} + {#if lastGroupYear !== year && canRenderYear}
{year}