Skip to content

Commit 1a912bc

Browse files
committed
♻️ refactor(提醒面板): 明日提醒优化,跨天事件如果包含明天,也要显示
- 移除重复的条件判断 - 优化代码可读性
1 parent 02aee0e commit 1a912bc

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/components/ReminderPanel.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -447,11 +447,8 @@ export class ReminderPanel {
447447
let isTomorrow = false;
448448
if (reminder.endDate) {
449449
// 跨天事件:明天在事件的时间范围内
450-
isTomorrow = (compareDateStrings(reminder.date, tomorrowStr) <= 0 &&
451-
compareDateStrings(tomorrowStr, reminder.endDate) <= 0) &&
452-
// 但不应该在今天已经显示的事件中重复
453-
!(compareDateStrings(reminder.date, today) <= 0 &&
454-
compareDateStrings(today, reminder.endDate) <= 0);
450+
isTomorrow = compareDateStrings(reminder.date, tomorrowStr) <= 0 &&
451+
compareDateStrings(tomorrowStr, reminder.endDate) <= 0;
455452
} else {
456453
// 单日事件:明天的事件
457454
isTomorrow = reminder.date === tomorrowStr;
@@ -566,11 +563,9 @@ export class ReminderPanel {
566563
case 'tomorrow':
567564
if (reminder.completed) return false;
568565
if (reminder.endDate) {
569-
// 跨天事件:明天在事件的时间范围内,但今天不在范围内
570-
return (compareDateStrings(reminder.date, tomorrowStr) <= 0 &&
571-
compareDateStrings(tomorrowStr, reminder.endDate) <= 0) &&
572-
!(compareDateStrings(reminder.date, today) <= 0 &&
573-
compareDateStrings(today, reminder.endDate) <= 0);
566+
// 跨天事件:明天在事件的时间范围内
567+
return compareDateStrings(reminder.date, tomorrowStr) <= 0 &&
568+
compareDateStrings(tomorrowStr, reminder.endDate) <= 0;
574569
} else {
575570
// 单日事件:明天的事件
576571
return reminder.date === tomorrowStr;

0 commit comments

Comments
 (0)