Skip to content

Build your personal knowledge base with Trilium Notes

feat(calendar_view): allow rendering multiple events from multiple relation

Elian Doran1b4281cf77e8
diff --git a/src/public/app/widgets/view_widgets/calendar_view.ts b/src/public/app/widgets/view_widgets/calendar_view.ts
index 2d3fda3c8c..8c3a8e4a6b 100644
--- a/src/public/app/widgets/view_widgets/calendar_view.ts
+++ b/src/public/app/widgets/view_widgets/calendar_view.ts
@@ -65,19 +65,22 @@ export default class CalendarView extends ViewMode {
continue;
}
- const eventData: typeof events[0] = {
- title: (await CalendarView.#parseCustomTitle(customTitle, note))[0],
- 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);
- }
+ const titles = await CalendarView.#parseCustomTitle(customTitle, note);
+ for (const title of titles) {
+ const eventData: typeof events[0] = {
+ title: 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);
+ events.push(eventData);
+ }
}
return events;