Skip to content

Commit d1ec208

Browse files
Merge pull request #101 from linked-planet/dev
Dev
2 parents 5a3b474 + 161d307 commit d1ec208

File tree

4 files changed

+44
-23
lines changed

4 files changed

+44
-23
lines changed

library/src/components/timetable/TimeTableHeader.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ import dayjs, { type Dayjs } from "dayjs"
22
import weekOfYear from "dayjs/plugin/weekOfYear"
33
import weekYear from "dayjs/plugin/weekYear"
44
import localeData from "dayjs/plugin/localeData"
5+
import utc from "dayjs/plugin/utc"
56
dayjs.extend(weekOfYear)
67
dayjs.extend(weekYear)
78
dayjs.extend(localeData)
9+
dayjs.extend(utc)
810
import type React from "react"
911
import { Fragment, type RefObject, useCallback, useRef, useState } from "react"
1012

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

package-lock.json

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
"stylelint-config-tailwindcss": "^0.0.7",
157157
"stylelint-order": "^6.0.4",
158158
"tailwind-merge": "^2.5.5",
159-
"tailwindcss": "^3.4.16",
159+
"tailwindcss": "^3.4.17",
160160
"typescript": "^5.7.2",
161161
"typescript-plugin-css-modules": "^5.1.0",
162162
"vite": "^6.0.3",

0 commit comments

Comments
 (0)