fix: calendar block not displaying events on boundary dates (#6463)

* fix: calendar block not displaying events on boundary dates

* fix: bug
This commit is contained in:
Katherine 2025-03-17 10:09:38 +08:00 committed by GitHub
parent 982c6fd5bf
commit 34528c4b0c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 10 deletions

View File

@ -153,9 +153,6 @@ export const DatePicker: ComposedDatePicker = (props: any) => {
return disabledTime; return disabledTime;
}); });
}; };
console.log(disabledDate);
const newProps = { const newProps = {
utc, utc,
...props, ...props,

View File

@ -132,8 +132,8 @@ const useEvents = (
const intervalTime = end.diff(start, 'millisecond', true); const intervalTime = end.diff(start, 'millisecond', true);
const dateM = dayjs(date); const dateM = dayjs(date);
let startDate = dateM.clone().startOf('month'); const startDate = dateM.clone().startOf('month');
let endDate = startDate.clone().endOf('month'); const endDate = startDate.clone().endOf('month');
/** /**
* view === month * view === month
@ -141,16 +141,16 @@ const useEvents = (
* 10.1 9.25 * 10.1 9.25
* 10.31 10.5 * 10.31 10.5
*/ */
if (view === 'month') { // if (view === 'month') {
startDate = startDate.startOf('week'); // startDate = startDate.startOf('week');
endDate = endDate.endOf('week'); // endDate = endDate.endOf('week');
} // }
const push = (eventStart: Dayjs = start.clone()) => { const push = (eventStart: Dayjs = start.clone()) => {
// 必须在这个月的开始时间和结束时间,且在日程的开始时间之后 // 必须在这个月的开始时间和结束时间,且在日程的开始时间之后
if ( if (
eventStart.isBefore(start) || // 开始时间早于 start eventStart.isBefore(start) || // 开始时间早于 start
(!eventStart.isBetween(startDate, endDate) && !end.isBetween(startDate, endDate)) // 开始时间和结束时间不在月份范围内 (!eventStart.isBetween(startDate, endDate, null, '[]') && !end.isBetween(startDate, endDate)) // 开始时间和结束时间不在月份范围内
) { ) {
return; return;
} }