Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.
HTML agent-skillsai-agentsarchitecture-diagramclaude-codeclaude-skillscodexcoding-agentsdeepseek-harnessdeveloper-toolsdiagramsdiagrams-as-codedsh-pluginflowchartllmmermaidopencodesequence-diagramsoftware-architecturesystem-designvisualization
fix(timeline): preserve historical calendar years in zone offsets
杨嘉伟5d5954c936fb
diff --git a/archify/renderers/timeline/render-timeline.mjs b/archify/renderers/timeline/render-timeline.mjsindex 9bff3822..95f4bdd7 100644--- a/archify/renderers/timeline/render-timeline.mjs+++ b/archify/renderers/timeline/render-timeline.mjs@@ -106,16 +106,19 @@ const timezone = tl.meta.timezone || 'UTC';// ---- Time zone formatting ------------------------------------------------------const partsFormat = new Intl.DateTimeFormat('en-US', {- timeZone: timezone, hourCycle: 'h23', year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit',+ timeZone: timezone, hourCycle: 'h23', era: 'short', year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit',});function wall(ms) {const parts = Object.fromEntries(partsFormat.formatToParts(new Date(ms)).map((part) => [part.type, part.value]));- return { y: parts.year, mo: parts.month, d: parts.day, h: parts.hour, mi: parts.minute, s: parts.second };+ return { y: parts.era === 'BC' ? String(1 - Number(parts.year)) : parts.year, mo: parts.month, d: parts.day, h: parts.hour, mi: parts.minute, s: parts.second };}// Offset of the display zone at an instant, in ms (local wall clock - UTC).function zoneOffset(ms) {const w = wall(ms);- return Date.UTC(+w.y, +w.mo - 1, +w.d, +w.h, +w.mi, +w.s) - Math.floor(ms / 1000) * 1000;+ const local = new Date(0);+ local.setUTCFullYear(+w.y, +w.mo - 1, +w.d);+ local.setUTCHours(+w.h, +w.mi, +w.s, 0);+ return local.getTime() - Math.floor(ms / 1000) * 1000;}function offsetLabel(ms) {const minutes = Math.round(zoneOffset(ms) / MINUTE);diff --git a/test/timeline-rendering.test.mjs b/test/timeline-rendering.test.mjsindex 6ae0c832..b87e4d88 100644--- a/test/timeline-rendering.test.mjs+++ b/test/timeline-rendering.test.mjs@@ -60,6 +60,19 @@ test('timeline: events are drawn in chronological order whatever the authored orassert.ok(report.events.every((event, index, all) => !index || event.x >= all[index - 1].x));});+test('timeline: historical years retain the actual display-zone UTC offset', () => {+ for (const year of ['0000', '0001', '0099', '0100', '2026']) {+ const diagram = clone(small);+ diagram.meta.timezone = 'UTC';+ diagram.events = [{ id: 'event', at: `${year}-01-01T00:00:00Z`, title: 'Historical event', lane: diagram.lanes[0].id }];+ const result = run(diagram);+ assert.equal(result.status, 0, result.stderr);+ const html = fs.readFileSync(result.output, 'utf8');+ assert.match(html, /UTC\+00:00/);+ assert.doesNotMatch(html, /UTC\+\d{3,}:/);+ }+});+test('timeline: offsets are honoured, so the same instant in two offsets aligns', () => {const diagram = clone(small);diagram.events.push({ id: 'same_instant', at: '2026-10-01T07:35:00+05:30', title: 'Same instant as the alert', lane: 'release' });