(icsEvent: ICSEvent, plugin: TaskNotesPlugin)
| 47 | } |
| 48 | |
| 49 | function 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 |
no test coverage detected