Skip to content

Commit 67c4355

Browse files
committed
Fix rendering of timeslots spanning two days
closes #328
1 parent 96fe040 commit 67c4355

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

newdle/client/src/components/answer/Calendar.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function calculateHeight(start, end, minHour, maxHour) {
3838
endMins = end.hours() * 60 + end.minutes();
3939
} else if (end.day() !== start.day()) {
4040
// the end of the slot is on another day so we will allow the slot to overflow
41-
endMins = maxHour * 60 + end.minutes();
41+
endMins = MAX_HOUR * 60 + end.hour() * 60 + end.minutes();
4242
}
4343

4444
if (startMins < minHour * 60) {

newdle/client/src/util/date.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ export function getHourSpan(input) {
4646
} else if (minTimelineHour < defaultMinHour) {
4747
// shift
4848
return [minTimelineHour, minTimelineHour + defaultHourSpan];
49+
} else if (maxTimelineHour > defaultMaxHour) {
50+
return [defaultMinHour, maxTimelineHour];
4951
} else {
5052
return [defaultMinHour, defaultMaxHour];
5153
}
@@ -66,7 +68,7 @@ export function hourRange(start, end, step = 1, extendToNextDay = true) {
6668
if (extendToNextDay) {
6769
hours.push(it - 24);
6870
}
69-
break;
71+
continue;
7072
}
7173

7274
hours.push(it);

0 commit comments

Comments
 (0)