Fix day header inserted into break

If a span ended on midnight the next day header would be started on the
break and the sameDay check would match the day of the next span causing
the day header to be inserted into the break column.  Fix by checking
that the last day header has a non-zero span in the same day check.
This commit is contained in:
Hornwitser 2025-03-06 00:37:40 +01:00
parent 3da83a7feb
commit 5044b7b58d

View file

@ -330,7 +330,8 @@ function tableElementsFromStretches(
} else {
startColumnGroup("break");
const dayName = stretch.start.slice(0, 10)
const sameDay = dayName === dayHeaders[dayHeaders.length - 1].content;
const lastDayHeader = dayHeaders[dayHeaders.length - 1]
const sameDay = dayName === lastDayHeader.content && lastDayHeader.span;
if (!sameDay)
startDay();
startHour("break");