Skip to content

Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.

fix(timeline): preserve milliseconds in time labels

cyanseek8a5ae6452972
diff --git a/archify.zip b/archify.zip
index df8df49f..d1769fb0 100644
Binary files a/archify.zip and b/archify.zip differ
diff --git a/archify/renderers/timeline/render-timeline.mjs b/archify/renderers/timeline/render-timeline.mjs
index f8db68c7..9bed74c4 100644
--- a/archify/renderers/timeline/render-timeline.mjs
+++ b/archify/renderers/timeline/render-timeline.mjs
@@ -149,7 +149,8 @@ const multiDay = (() => {
})();
function clockLabel(ms, { seconds = showSeconds, date = multiDay } = {}) {
const w = wall(ms);
- return `${date ? `${w.mo}-${w.d} ` : ''}${w.h}:${w.mi}${seconds ? `:${w.s}` : ''}`;
+ const fraction = new Date(ms).getUTCMilliseconds();
+ return `${date ? `${w.mo}-${w.d} ` : ''}${w.h}:${w.mi}${seconds ? `:${w.s}${fraction ? `.${String(fraction).padStart(3, '0')}` : ''}` : ''}`;
}
function durationLabel(ms) {
diff --git a/test/timeline-rendering.test.mjs b/test/timeline-rendering.test.mjs
index 6001adc7..f33b53c6 100644
--- a/test/timeline-rendering.test.mjs
+++ b/test/timeline-rendering.test.mjs
@@ -28,6 +28,32 @@ function layoutOf(diagram) {
}
const overlap = (a, b) => a.left < b.left + b.width && b.left < a.left + a.width && a.top < b.top + b.height && b.top < a.top + a.height;
+test('timeline: subsecond events retain their time in cards and accessible context', () => {
+ const diagram = clone(small);
+ diagram.meta.timezone = 'Asia/Kolkata';
+ diagram.events = [
+ { id: 'sent', title: 'Request sent', at: '2026-10-01T10:00:00.007Z', lane: 'release' },
+ { id: 'reply', title: 'Reply received', at: '2026-10-01T15:30:00.900+05:30', lane: 'release' },
+ { id: 'done', title: 'Finished', at: '2026-10-01T10:00:01Z', lane: 'release' },
+ ];
+ const result = run(diagram);
+ assert.equal(result.status, 0, result.stderr);
+ const html = fs.readFileSync(result.output, 'utf8');
+ for (const [id, time] of [['sent', '15:30:00.007'], ['reply', '15:30:00.900'], ['done', '15:30:01']]) {
+ const node = html.match(new RegExp(`<g [^>]*data-node-id="${id}"[^>]*>[\\s\\S]*?</g>`))?.[0];
+ assert.ok(node, id);
+ assert.ok(node.includes(`UTC+05:30`), node);
+ assert.ok(node.includes(`10-01 ${time} UTC+05:30`), node);
+ assert.ok(node.includes(`>${time}</text>`), node);
+ }
+ const report = layoutOf(diagram);
+ assert.equal(report.events[1].t - report.events[0].t, 893);
+ assert.ok(report.events[1].x > report.events[0].x);
+ for (const card of report.events) for (const other of report.events) {
+ if (card.id < other.id) assert.ok(!overlap(card, other), `${card.id} overlaps ${other.id}`);
+ }
+});
+
test('timeline: both examples render and pass the showcase artifact checks', () => {
for (const diagram of [small, large]) {
const result = run(diagram);