Skip to content

Build your personal knowledge base with Trilium Notes

feat(views/calendar): basic recursion for calendar root

Elian Doranf4e6edd19edd
diff --git a/src/public/app/widgets/view_widgets/calendar_view.ts b/src/public/app/widgets/view_widgets/calendar_view.ts
index 8a7e797bba..9cdb069783 100644
--- a/src/public/app/widgets/view_widgets/calendar_view.ts
+++ b/src/public/app/widgets/view_widgets/calendar_view.ts
@@ -215,10 +215,17 @@ export default class CalendarView extends ViewMode {
const events: EventSourceInput = [];
for (const note of notes) {
- const startDate = note.getAttributeValue("label", "startDate");
+ const startDate = note.getLabelValue("startDate") ?? note.getLabelValue("dateNote");
const customTitle = note.getAttributeValue("label", "calendar:title");
const color = note.getAttributeValue("label", "calendar:color") ?? note.getAttributeValue("label", "color") ?? undefined;
+ if (note.hasChildren()) {
+ const childrenEventData = await this.#buildEvents(note.getChildNoteIds());
+ if (childrenEventData.length > 0) {
+ events.push(childrenEventData);
+ }
+ }
+
if (!startDate) {
continue;
}
@@ -243,7 +250,7 @@ export default class CalendarView extends ViewMode {
}
}
- return events;
+ return events.flat();
}
static async #parseCustomTitle(customTitleValue: string | null, note: FNote, allowRelations = true): Promise<string[]> {