File tree Expand file tree Collapse file tree 1 file changed +6
-21
lines changed Expand file tree Collapse file tree 1 file changed +6
-21
lines changed Original file line number Diff line number Diff line change @@ -199,6 +199,8 @@ import {
199
199
addHours ,
200
200
differenceInDays ,
201
201
isSameDay ,
202
+ min ,
203
+ max
202
204
} from " date-fns" ;
203
205
import { guid } from " ../helpers/Utility" ;
204
206
@@ -340,28 +342,11 @@ function onMouseMove(mouseEvent: MouseEvent) {
340
342
341
343
const mouseDownColumnDate = getDateFromX (startX );
342
344
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
- }
350
-
351
- if (
352
- ! isSameDay (startDate , initialState .startDate ) ||
353
- (mouseDown .handle === " bottom" &&
354
- (isAfter (endDate , max ) ||
355
- isBefore (
356
- endDate ,
357
- addMinutes (mouseDownColumnDate , props .intervalMinutes )
358
- )))
359
- ) {
360
- return ;
361
- }
345
+ const startOfNextDay = addDays (mouseDownColumnDate , 1 );
346
+ const max = addHours (startOfNextDay , props .hoursPastMidnight );
362
347
363
- event .startDate = startDate ;
364
- event .endDate = endDate ;
348
+ event .startDate = min ([ startDate , addMinutes ( startOfNextDay , - props . intervalMinutes )]) ;
349
+ event .endDate = min ([ endDate , max ]) ;
365
350
}
366
351
}
367
352
You can’t perform that action at this time.
0 commit comments