From c029b03f70ea3b32596ffffc53ce57be1b2d99f9 Mon Sep 17 00:00:00 2001 From: Giorgio Mandolini Date: Sun, 21 Apr 2024 09:34:04 +0200 Subject: [PATCH] fix: wrong event positioning when using portion of hours #353 --- src/lib/components/events/TodayEvents.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/components/events/TodayEvents.tsx b/src/lib/components/events/TodayEvents.tsx index ea3dbb2..eb1dccc 100644 --- a/src/lib/components/events/TodayEvents.tsx +++ b/src/lib/components/events/TodayEvents.tsx @@ -40,7 +40,9 @@ const TodayEvents = ({ {todayEvents.map((event, i) => { const height = differenceInMinutes(event.end, event.start) * minuteHeight - BORDER_HEIGHT; - const minituesFromTop = Math.abs(startHour - event.start.getHours()) * 60; + const minituesFromTop = Math.abs( + startHour * 60 - event.start.getHours() * 60 - event.start.getMinutes() + ); const topSpace = minituesFromTop * minuteHeight; /** Add border factor to height of each slot */ const slots = height / 60;