fix(weather): weather cards measure from the timeline time and know when wind follows it

At a past time the radar, lightning and satellite cards aged the shown
frame and judged the source delayed against the wall clock, so a frame
from years back read "Source observations delayed" and an age in the
millions of minutes. Frame ages, the delayed status and the stale stat
now count from the timeline time at a past time, and from now while
live, as before. The observed timeline's readout and preview show the
time alone at a past time, since its age from the timeline time is
always zero.

The wind card noted that it does not follow the timeline whenever the
observed clock was at a past time, even when a host follows the world
clock for wind. The weather clock now reports whether a layer follows the world
clock (weatherClock.follows(id), the world clock's follows), and the
wind row and card drop that note when its source follows the timeline.
This commit is contained in:
Sameh Khamis committed 2026-11-14 17:04:55 -08:00
1 parent 7b4b4d4184
commit 6e23a73283
8 files changed
+151 -21

No files matched your search

+44 -2
View File
@@ -506,9 +506,10 @@ test('compact lines show observation age, forecast validity, storm selection or
'Forecast · valid 09-22 01:00 UTC',
);
f.state({ mode: 'history', target: ticks[1] });
// At a past time a frame's age counts from the timeline time.
assert.equal(
compact(radar.id).textContent,
'09-22 01:05 UTC · 8m ago · synced',
'09-22 01:05 UTC · 0m ago · synced',
);
assert.equal(
compact(wind.id).textContent,
@@ -523,7 +524,7 @@ test('compact lines show observation age, forecast validity, storm selection or
});
assert.equal(
compact(radar.id).textContent,
'09-22 01:00 UTC · 13m ago · nearest',
'09-22 01:00 UTC · 5m ago · nearest',
);
clickHeader(f, wind.id);
assert.equal(
@@ -787,3 +788,44 @@ test('source-supplied legend units are shown as given; catalog units are transla
setLocale('en');
}
});
test('at a past time, frame ages and the timeline readout count from the timeline time, not now', (t) => {
t.mock.timers.enable({
apis: ['Date'],
now: Date.parse('2032-01-01T00:00:00Z'),
});
const f = fixture();
const view = createWeatherPanel(f);
view.update([radar]);
f.state({
mode: 'history',
target: '2026-09-22T01:20:00Z',
products: [{ id: radar.id, shown: ticks[1], selected: ticks[1] }],
});
assert.equal(
line(f, radar.id, 'time').textContent,
'09-22 01:05 UTC · 15m ago · nearest',
);
const readout = f.find((n) => n.textContent === '01:20 UTC');
assert.ok(readout, 'the readout names the timeline time');
assert.doesNotMatch(timelineHost(f).textContent, /min ago/);
view.destroy();
});
test('the wind card notes it stays live only while its source does not follow the timeline', () => {
const f = fixture();
const following = new Set();
f.clock.follows = (id) => following.has(id);
const view = createWeatherPanel(f);
view.update([wind, radar]);
f.state({ mode: 'history', target: ticks[1] });
assert.match(line(f, 'wind', 'time').textContent, /Does not follow history/);
following.add('wind');
f.state({ target: ticks[0] });
assert.match(line(f, 'wind', 'time').textContent, /^Forecast · valid /);
assert.doesNotMatch(
line(f, 'wind', 'time').textContent,
/Does not follow history/,
);
view.destroy();
});