Skip to content

Build your personal knowledge base with Trilium Notes

fix: 🐛 fix prev/next month date not link to right note

Jin3b67364916de
diff --git a/src/public/app/widgets/buttons/calendar.ts b/src/public/app/widgets/buttons/calendar.ts
index 08ab2186be..b5a06cce94 100644
--- a/src/public/app/widgets/buttons/calendar.ts
+++ b/src/public/app/widgets/buttons/calendar.ts
@@ -346,9 +346,12 @@ export default class CalendarWidget extends RightDropdownButtonWidget {
this.$month.append($weekNumber);
dates.forEach(date => {
+ const tempDate = this.date;
+ this.date = date;
const $day = this.createDay(dateNotesForPrevMonth, date.getDate(), date.getDay());
$day.addClass('calendar-date-prev-month');
this.$month.append($day);
+ this.date = tempDate;
});
}
@@ -383,9 +386,12 @@ export default class CalendarWidget extends RightDropdownButtonWidget {
const dateNotesForNextMonth: DateNotesForMonth = await server.get(`special-notes/notes-for-month/${nextMonthStr}`);
dates.forEach(date => {
+ const tempDate = this.date;
+ this.date = date;
const $day = this.createDay(dateNotesForNextMonth, date.getDate(), date.getDay());
$day.addClass('calendar-date-next-month');
this.$month.append($day);
+ this.date = tempDate;
});
}