openvibers/openvibe.trade Commits
Home: the Latest column's observation time is a real <time>, not escaped markup (it widened the table past the page at 1280 px; browser check) (#76)
Changes
@@@ -89,7 +89,7 @@ function home({ page, recent, urls, sync, pager, latest = new Map(), latestDocs// The headline number when there is one; else the newest filing (most companies on a given day only filed); else// nothing to show yet beyond the SEC's company list.const latestCell = (i, o, d) => (o-- ? html`<td class="num"><data value="${o.value}">${grouped(o.value)}</data> ${o.unit} <span class="muted">${labelOf(o.metric)}${o.period ? `, ${o.period}` : `, ${when(o.observed_at)}`}</span>${o.freshness && o.freshness.stale ? html` ${staleBadge(o.freshness)}` : ''}</td>`++ ? html`<td class="num"><data value="${o.value}">${grouped(o.value)}</data> ${o.unit} <span class="muted">${labelOf(o.metric)}${o.period ? `, ${o.period}` : html`, ${when(o.observed_at)}`}</span>${o.freshness && o.freshness.stale ? html` ${staleBadge(o.freshness)}` : ''}</td>`: d ? html`<td><a href="${urls.path.instrument(i)}#${d.id}">${d.form_type ? html`<span class="badge">${d.form_type}</span> ` : ''}filed ${when(d.published_at || d.first_seen_at)}</a></td>`: html`<td><span class="muted">on the SEC's company list</span></td>`);const rows = page.instruments.map((i) => html`<tr>nnew file mode 100644@@@ -0,0 +1,14 @@++'use strict';++// The home's "Latest" column: a figure with no period names when it was observed as a real <time>, not as escaped++// markup (the browser check of 2026-10-17 found "<time datetime=…>" text widening the table past the page).++const assert = require('assert');++const views = require('../server/render/views');++++const urls = { path: { instrument: (i) => `/i/${i.symbol}` } };++const page = { instruments: [{ id: 1, symbol: 'AUD', name: 'Australian Dollar', kind: 'currency', exchange: null }] };++const latest = new Map([[1, { value: 1.6172, unit: 'AUD', metric: 'rate', period: null, observed_at: '2026-10-17T00:00:00.000Z' }]]);++const out = String(views.home({ page, recent: [], urls, sync: null, pager: null, latest }));++const cell = out.slice(out.indexOf('<td class="num">'), out.indexOf('</td>', out.indexOf('<td class="num">')));++assert.ok(cell.includes('<time datetime="2026-10-17T00:00:00.000Z">2026-10-17 00:00 UTC</time>'), cell);++assert.ok(!out.includes('<time'), 'no escaped markup');++console.log('home latest cell: all checks passed');
@@ -89,7 +89,7 @@ function home({ page, recent, urls, sync, pager, latest = new Map(), latestDocs
@@ -89,7 +89,7 @@ function home({ page, recent, urls, sync, pager, latest = new Map(), latestDocs
// The headline number when there is one; else the newest filing (most companies on a given day only filed); else
// The headline number when there is one; else the newest filing (most companies on a given day only filed); else
// nothing to show yet beyond the SEC's company list.
// nothing to show yet beyond the SEC's company list.
const latestCell = (i, o, d) => (o
const latestCell = (i, o, d) => (o
- ? html`<td class="num"><data value="${o.value}">${grouped(o.value)}</data> ${o.unit} <span class="muted">${labelOf(o.metric)}${o.period ? `, ${o.period}` : `, ${when(o.observed_at)}`}</span>${o.freshness && o.freshness.stale ? html` ${staleBadge(o.freshness)}` : ''}</td>`
+ ? html`<td class="num"><data value="${o.value}">${grouped(o.value)}</data> ${o.unit} <span class="muted">${labelOf(o.metric)}${o.period ? `, ${o.period}` : html`, ${when(o.observed_at)}`}</span>${o.freshness && o.freshness.stale ? html` ${staleBadge(o.freshness)}` : ''}</td>`
: d ? html`<td><a href="${urls.path.instrument(i)}#${d.id}">${d.form_type ? html`<span class="badge">${d.form_type}</span> ` : ''}filed ${when(d.published_at || d.first_seen_at)}</a></td>`
: d ? html`<td><a href="${urls.path.instrument(i)}#${d.id}">${d.form_type ? html`<span class="badge">${d.form_type}</span> ` : ''}filed ${when(d.published_at || d.first_seen_at)}</a></td>`
: html`<td><span class="muted">on the SEC's company list</span></td>`);
: html`<td><span class="muted">on the SEC's company list</span></td>`);
const rows = page.instruments.map((i) => html`<tr>
const rows = page.instruments.map((i) => html`<tr>
new file mode 100644
new file mode 100644
@@ -0,0 +1,14 @@
@@ -0,0 +1,14 @@
+'use strict';
+// The home's "Latest" column: a figure with no period names when it was observed as a real <time>, not as escaped
+// markup (the browser check of 2026-10-17 found "<time datetime=…>" text widening the table past the page).
+const assert = require('assert');
+const views = require('../server/render/views');
+
+const urls = { path: { instrument: (i) => `/i/${i.symbol}` } };
+const page = { instruments: [{ id: 1, symbol: 'AUD', name: 'Australian Dollar', kind: 'currency', exchange: null }] };
+const latest = new Map([[1, { value: 1.6172, unit: 'AUD', metric: 'rate', period: null, observed_at: '2026-10-17T00:00:00.000Z' }]]);
+const out = String(views.home({ page, recent: [], urls, sync: null, pager: null, latest }));
+const cell = out.slice(out.indexOf('<td class="num">'), out.indexOf('</td>', out.indexOf('<td class="num">')));
+assert.ok(cell.includes('<time datetime="2026-10-17T00:00:00.000Z">2026-10-17 00:00 UTC</time>'), cell);
+assert.ok(!out.includes('<time'), 'no escaped markup');
+console.log('home latest cell: all checks passed');