Skip to content

Commit 161d307

Browse files
committed
time table utils - added width debug output
1 parent 0319c5f commit 161d307

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

library/src/components/timetable/timeTableUtils.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,26 @@ export function getLeftAndWidth(
458458
}
459459

460460
const timeSpanMin = itemModEnd.diff(itemModStart, "minute")
461-
const width = timeSpanMin / timeSlotMinutes
461+
const timeSpanDayDiff = itemModEnd.diff(itemModStart, "day")
462+
const overnightDiff =
463+
24 * 60 * timeSpanDayDiff - timeSpanDayDiff * timeFrameDay.oneDayMinutes
464+
const timeSpanMinWithoutOvernight = timeSpanMin - overnightDiff
465+
466+
// remove night if it is not in the time frame
467+
468+
const width = timeSpanMinWithoutOvernight / timeSlotMinutes
469+
470+
console.log(
471+
"WIDTH TEST",
472+
width,
473+
timeSpanMin / timeSlotMinutes,
474+
overnightDiff,
475+
dayStartDiff,
476+
itemModStart.format(),
477+
itemModEnd.format(),
478+
item.startDate.format(),
479+
item.endDate.format(),
480+
)
462481

463482
if (width <= 0) {
464483
// this should not happen, but if it does, we need to log it to find the error

0 commit comments

Comments
 (0)