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

Function formatTimeRange

src/ui/ICSCard.ts:49–67  ·  view source on GitHub ↗
(icsEvent: ICSEvent, plugin: TaskNotesPlugin)

Source from the content-addressed store, hash-verified

47}
48
49function formatTimeRange(icsEvent: ICSEvent, plugin: TaskNotesPlugin): string {
50 try {
51 if (!icsEvent.start) return "";
52 const start = new Date(icsEvent.start);
53 if (icsEvent.allDay) {
54 return plugin.i18n.translate("ui.icsCard.allDay");
55 }
56 const timeFormat = plugin.settings.calendarViewSettings.timeFormat;
57 const startText = formatTime(start, timeFormat);
58 if (icsEvent.end) {
59 const end = new Date(icsEvent.end);
60 const endText = formatTime(end, timeFormat);
61 return `${startText} – ${endText}`;
62 }
63 return startText;
64 } catch {
65 return "";
66 }
67}
68
69/**
70 * Create a compact ICS event card styled similar to TaskCard

Callers 2

createICSEventCardFunction · 0.85
updateICSEventCardFunction · 0.85

Calls 2

formatTimeFunction · 0.90
translateMethod · 0.65

Tested by

no test coverage detected