Skip to content

Build your personal knowledge base with Trilium Notes

feat(calendar_view): render notes by their end date

Elian Doran8111352300e2
diff --git a/src/public/app/widgets/view_widgets/calendar_view.ts b/src/public/app/widgets/view_widgets/calendar_view.ts
index b222e86d59..af0a54b4a1 100644
--- a/src/public/app/widgets/view_widgets/calendar_view.ts
+++ b/src/public/app/widgets/view_widgets/calendar_view.ts
@@ -58,15 +58,23 @@ export default class CalendarView extends ViewMode {
for (const note of notes) {
const startDate = note.getAttributeValue("label", "startDate");
-
if (!startDate) {
continue;
}
- events.push({
+ const eventData: typeof events[0] = {
title: note.title,
start: startDate
- });
+ };
+
+ const endDate = new Date(note.getAttributeValue("label", "endDate") ?? startDate);
+ if (endDate) {
+ // Fullcalendar end date is exclusive, not inclusive.
+ endDate.setDate(endDate.getDate() + 1);
+ eventData.end = endDate.toISOString().substring(0, 10);
+ }
+
+ events.push(eventData);
}
return events;