File tree Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Original file line number Diff line number Diff line change 52
52
import DayEvent from " ./DayEvent.vue" ;
53
53
import { $CalendarEvent } from " ../types/interfaces" ;
54
54
import { computed , onMounted , onUnmounted , ref } from " vue" ;
55
- import { isSameDay , isToday } from " date-fns" ;
55
+ import { isSameDay , isAfter } from " date-fns" ;
56
56
import {
57
57
calculatePositions ,
58
58
processConcurrency ,
@@ -90,7 +90,11 @@ onUnmounted(() => {
90
90
const isDateToday = computed (() => isSameDay (now .value , props .date ));
91
91
92
92
const filteredEvents = computed (() => {
93
- let filtered = props .events .filter ((e ) => isSameDay (e .startDate , props .date ) || isSameDay (e .endDate , props .date ));
93
+ let filtered = props .events .filter (
94
+ (e ) =>
95
+ isSameDay (e .startDate , props .date ) ||
96
+ (isSameDay (e .endDate , props .date ) && isAfter (e .endDate , props .date ))
97
+ );
94
98
return props .concurrencyMode == " stack"
95
99
? processConcurrency (filtered )
96
100
: calculatePositions (filtered );
Original file line number Diff line number Diff line change @@ -192,6 +192,7 @@ import {
192
192
addMinutes ,
193
193
endOfDay ,
194
194
isAfter ,
195
+ isBefore ,
195
196
startOfDay ,
196
197
differenceInCalendarDays ,
197
198
addDays ,
@@ -338,14 +339,23 @@ function onMouseMove(mouseEvent: MouseEvent) {
338
339
: [newTime , anchor ];
339
340
340
341
const mouseDownColumnDate = getDateFromX (startX );
341
- let max = isSameDay (mouseDownColumnDate , initialState .endDate )
342
- ? endOfDay (mouseDownColumnDate )
343
- : startOfDay (addDays (initialState .startDate , 1 ));
344
- max = addHours (max , props .hoursPastMidnight );
342
+
343
+ let max: Date ;
344
+ if (isSameDay (mouseDownColumnDate , initialState .endDate )) {
345
+ max = endOfDay (mouseDownColumnDate );
346
+ } else {
347
+ max = startOfDay (addDays (initialState .startDate , 1 ));
348
+ max = addHours (max , props .hoursPastMidnight );
349
+ }
345
350
346
351
if (
347
352
! isSameDay (startDate , initialState .startDate ) ||
348
- isAfter (endDate , max )
353
+ isAfter (endDate , max ) ||
354
+ (mouseDown .handle == " bottom" &&
355
+ isBefore (
356
+ endDate ,
357
+ addMinutes (mouseDownColumnDate , props .intervalMinutes )
358
+ ))
349
359
) {
350
360
return ;
351
361
}
You can’t perform that action at this time.
0 commit comments