fix: events not display in calendar block when start and end dates span across month (#5699)

This commit is contained in:
Katherine 2024-11-21 15:35:47 +08:00 committed by GitHub
parent 5b1c0b2002
commit f351f78936
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -135,10 +135,12 @@ const useEvents = (
const push = (eventStart: Dayjs = start.clone()) => {
// 必须在这个月的开始时间和结束时间,且在日程的开始时间之后
if (eventStart.isBefore(start) || !eventStart.isBetween(startDate, endDate)) {
if (
eventStart.isBefore(start) || // 开始时间早于 start
(!eventStart.isBetween(startDate, endDate) && !end.isBetween(startDate, endDate)) // 开始时间和结束时间不在月份范围内
) {
return;
}
let out = false;
const res = exclude?.some((d) => {
if (d.endsWith('_after')) {
@ -162,6 +164,7 @@ const useEvents = (
events.push(event);
};
if (cron === 'every_week') {
let nextStart = start
.clone()