Public: anyone can read this; the crew can change it.
A .ics calendar file opens as a dated list of events with title, start, end and place #14170
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/14160-a-ics-calendar-file-opens-as-a-dated-lis → main 4 commits fork 2 threads · 2 unresolved
2 files
changed +10
−3
docs/features/ics.md +3 −3
| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | # Calendar files (.ics) as a list of events |
| 2 | 2 | |
| 3 | Open a `.ics` file in a repository, such as a calendar export, and read its events as a table: start, end, summary, location, in the file's own order. | |
| 3 | Open a `.ics` file in a repository, such as a calendar export, and read its events as a table: start, end, summary, location, sorted by start. | |
| 4 | 4 | |
| 5 | 5 | - **Web:** the blob page draws the table on the server (`src/web/render/ics.ts`, `parseIcs`). `?view=source`, Raw and Download work as for any file. |
| 6 | 6 | - **Terminal:** the workspace opens a `.ics` as the same table (`src/tui/screens/workspace.ts`, sharing `parseIcs` and `EVENT_CAP`); `s` flips to the source. The status line reads `N events`, and `· N events could not be read, not shown` when some were skipped. |
| 7 | 7 | - Folded lines are unfolded and `\,` `\;` `\n` escapes are undone. UTC times show as `UTC`, `TZID` times keep their zone name, all-day events show dates and the last day (the file's end is exclusive). |
| 8 | - Events appear in the order the file lists them; times are shown as written, with their zone name, and no zone is applied. | |
| 8 | - Events are sorted by their start as written (ties keep file order); times are shown as written, with their zone name, and no zone is applied. | |
| 9 | 9 | - An event with no readable `DTSTART` is skipped, and both doors count them in one line (the web's, under the table; the terminal's, in the status line). |
| 10 | - The first 500 events (`EVENT_CAP`) are shown; the rest are counted. | |
| 10 | - The first 200 events (`EVENT_CAP`) are shown; the rest are counted. | |
| 11 | 11 | - A file with no `BEGIN:VCALENDAR` is not a calendar, and a calendar where no event could be read, or with none: it shows as source, with a one-line reason on the web. |
| 12 | 12 | - All text is escaped on output; the parser is pure and never throws. |
test/render-ics.test.ts +7
| @@ -93,6 +93,13 @@ describe("calendar files", () => { | ||
| 93 | 93 | expect(out.indexOf(">b<")).toBeLessThan(out.indexOf(">a<")); |
| 94 | 94 | }); |
| 95 | 95 | |
| 96 | test("the same wall time in two zones keeps file order, not zone-name order", () => { | |
| 97 | const out = String( | |
| 98 | draw(wrap("DTSTART:20260301T090000Z\r\nSUMMARY:utc", "DTSTART;TZID=Europe/Paris:20260301T090000\r\nSUMMARY:paris")).content, | |
| 99 | ); | |
| 100 | expect(out.indexOf(">utc<")).toBeLessThan(out.indexOf(">paris<")); | |
| 101 | }); | |
| 102 | ||
| 96 | 103 | test("malformed files fall back to text", () => { |
| 97 | 104 | expect(draw("just some words").fallback).toBeDefined(); |
| 98 | 105 | expect(draw("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nDTSTART:20260301\r\n").fallback).toContain("could be read"); |
new above
offline
Good regression test: UTC-first order fails on the old code. Optional: add a second pair listed Paris-first so both orders are pinned.