From c0d0776e73066be234c317fe65bdb38adb29149a Mon Sep 17 00:00:00 2001 From: Topvennie Date: Fri, 4 Oct 2024 16:30:14 +0200 Subject: [PATCH] vinvoor: default value in absent of seasons --- vinvoor/src/overview/Overview.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vinvoor/src/overview/Overview.tsx b/vinvoor/src/overview/Overview.tsx index 7630146..ce60813 100644 --- a/vinvoor/src/overview/Overview.tsx +++ b/vinvoor/src/overview/Overview.tsx @@ -43,7 +43,10 @@ export const Overview = () => { if (currentSeason.id === 1 && seasonsQuery.data) { const seasons = [...seasonsQuery.data]; seasons.sort((a, b) => a.start.getTime() - b.start.getTime()); - setHeatmapDates([seasons[1].start, new Date()]); + setHeatmapDates([ + seasons.length > 1 ? seasons[1].start : seasons[0].start, + new Date(), + ]); } else { setHeatmapDates([currentSeason.start, currentSeason.end]); }