From 1b5e919fe63f6e683233d4cf5ea825478c2887b9 Mon Sep 17 00:00:00 2001 From: Marwin Hochfelsner <50826859+hlfan@users.noreply.github.com> Date: Sun, 18 Jan 2026 23:00:27 +0100 Subject: [PATCH] Fix month label index desync causing missing labels --- app/assets/javascripts/heatmap.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/heatmap.js b/app/assets/javascripts/heatmap.js index fc7ed85e5..c60b6bf90 100644 --- a/app/assets/javascripts/heatmap.js +++ b/app/assets/javascripts/heatmap.js @@ -3,6 +3,7 @@ $(document).on("turbo:frame-load", function () { const weekInfo = getWeekInfo(); const maxPerDay = heatmap.data("max-per-day"); const weekdayLabels = heatmap.find("[data-weekday]"); + const monthLabelStartIndex = Math.min(...heatmap.find("[data-month]").get().map(l => l.dataset.month)); let weekColumn = 1; let previousMonth = null; @@ -24,7 +25,7 @@ $(document).on("turbo:frame-load", function () { weekColumn++; const currentMonth = getMonthOfThisWeek(date); if (previousMonth === null) { - previousMonth = currentMonth; + previousMonth = currentMonth + (Math.round((monthLabelStartIndex - currentMonth) / 12) * 12); heatmap.find(`[data-month]:has( ~ [data-month="${previousMonth}"])`).remove(); heatmap.find("[data-month]").first().css("grid-column-start", 2); } -- 2.39.5