Skip to content

Commit 1f3cf94

Browse files
tylerdcooperclaude
andcommitted
Fix time label drift causing now-line misalignment (v1.4.2)
margin-top:-8px on .time-label accumulated across 24 labels, drifting the gutter text ~176px above the correct position by 11 PM. Replaced with transform:translateY(-8px) which achieves the same visual offset without affecting layout flow, so every label aligns precisely with its corresponding hour line in the time grid. Also remove now-line time label and debug console.log per user request. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 182ee9c commit 1f3cf94

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

custom_components/couple_calendar/frontend/couple-calendar-panel.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ function buildStyles(cfg) {
227227
.time-gutter { width: 56px; flex-shrink: 0; border-right: 1px solid ${p.border}; position: relative; }
228228
.time-label {
229229
height: 60px; display: flex; align-items: flex-start; justify-content: flex-end;
230-
padding: 0 8px; font-size: 11px; color: ${p.textSub}; margin-top: -8px;
230+
padding: 0 8px; font-size: 11px; color: ${p.textSub}; transform: translateY(-8px);
231231
}
232232
.week-days-grid { flex: 1; display: grid; gap: 2px; position: relative; }
233233
.week-day-time-col { position: relative; border-right: 1px solid ${p.border}; }
@@ -850,10 +850,8 @@ class CoupleCalendarPanel extends HTMLElement {
850850
}).join("")}
851851
</div>`).join("");
852852

853-
const now = new Date();
854-
const nowMin = now.getHours() * 60 + now.getMinutes();
855-
const nowLabel = formatTime(now, use24);
856-
console.log(`[CoupleCalendar] now-line: ${now.toString()} | getHours()=${now.getHours()} getMinutes()=${now.getMinutes()} | nowMin=${nowMin} | top=${(nowMin/60)*HOUR_H}px`);
853+
const now = new Date();
854+
const nowMin = now.getHours() * 60 + now.getMinutes();
857855
const todayIdx = days.findIndex(d => isSameDay(d, this._today));
858856
const hours = Array.from({ length: 24 }, (_, h) => h);
859857

@@ -878,10 +876,9 @@ class CoupleCalendarPanel extends HTMLElement {
878876
</div>`;
879877
}).join("");
880878

881-
const nowPx = (nowMin / 60) * HOUR_H;
882879
const hourLines = hours.map(h => `<div class="hour-line" style="top:${h*HOUR_H}px;"></div>`).join("");
883880
const nowLine = di === todayIdx
884-
? `<div class="now-line" style="top:${nowPx}px;"><span class="now-time-label">${nowLabel}</span></div>`
881+
? `<div class="now-line" style="top:${(nowMin/60)*HOUR_H}px;"></div>`
885882
: "";
886883
const isToday = di === todayIdx;
887884
return `<div class="week-day-time-col ${isToday ? "today-col" : ""}" style="height:${24*HOUR_H}px;">${hourLines}${nowLine}${blocks}</div>`;

custom_components/couple_calendar/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"domain": "couple_calendar",
33
"name": "Couple Calendar",
4-
"version": "1.4.1",
4+
"version": "1.4.2",
55
"documentation": "https://github.com/tylerdcooper/couple-calendar",
66
"issue_tracker": "https://github.com/tylerdcooper/couple-calendar/issues",
77
"codeowners": ["@tylerdcooper"],

0 commit comments

Comments
 (0)