Skip to content

Commit d7323d3

Browse files
committed
fix: lock start/end time-changes to day column
1 parent 44b69da commit d7323d3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/components/Week.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,9 @@ import {
195195
startOfDay,
196196
differenceInCalendarDays,
197197
addDays,
198+
addHours,
198199
differenceInDays,
200+
isSameDay,
199201
} from "date-fns";
200202
import { guid } from "../helpers/Utility";
201203
@@ -332,6 +334,14 @@ function onMouseMove(mouseEvent: MouseEvent) {
332334
? [anchor, newTime]
333335
: [newTime, anchor];
334336
337+
let max = startOfDay(addDays(initialState.startDate, 1));
338+
max = addHours(max, props.hoursPastMidnight);
339+
340+
if (!isSameDay(startDate, initialState.startDate) ||
341+
isAfter(endDate,max)) {
342+
return;
343+
}
344+
335345
event.startDate = startDate;
336346
event.endDate = endDate;
337347
}

0 commit comments

Comments
 (0)