MCPcopy
hub / github.com/callumalpass/tasknotes / buildICSEventDetails

Method buildICSEventDetails

src/services/ICSNoteService.ts:651–693  ·  view source on GitHub ↗

* Build default event details from ICS event data

(icsEvent: ICSEvent, subscriptionName: string)

Source from the content-addressed store, hash-verified

649 * Build default event details from ICS event data
650 */
651 private buildICSEventDetails(icsEvent: ICSEvent, subscriptionName: string): string {
652 const details: string[] = [];
653
654 details.push(`# ${icsEvent.title}`);
655 details.push("");
656
657 if (icsEvent.start) {
658 // For all-day events with date-only format (YYYY-MM-DD), append T00:00:00 to parse as local midnight
659 const startDateStr =
660 icsEvent.allDay && /^\d{4}-\d{2}-\d{2}$/.test(icsEvent.start)
661 ? icsEvent.start + "T00:00:00"
662 : icsEvent.start;
663 const startDate = new Date(startDateStr);
664 details.push(`**Start:** ${format(startDate, "PPPp")}`);
665 }
666
667 if (icsEvent.end && !icsEvent.allDay) {
668 const endDateStr = /^\d{4}-\d{2}-\d{2}$/.test(icsEvent.end)
669 ? icsEvent.end + "T00:00:00"
670 : icsEvent.end;
671 const endDate = new Date(endDateStr);
672 details.push(`**End:** ${format(endDate, "PPPp")}`);
673 }
674
675 if (icsEvent.location) {
676 details.push(`**Location:** ${icsEvent.location}`);
677 }
678
679 details.push(`**Calendar:** ${subscriptionName}`);
680
681 if (icsEvent.description) {
682 details.push("");
683 details.push("## Description");
684 details.push(icsEvent.description);
685 }
686
687 if (icsEvent.url) {
688 details.push("");
689 details.push(`**Event URL:** ${icsEvent.url}`);
690 }
691
692 return details.join("\n");
693 }
694
695 /**
696 * Format a value for YAML frontmatter

Callers 2

createTaskFromICSMethod · 0.95
createNoteFromICSMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected