Fix day cycle
This commit is contained in:
fraxle
2026-06-11 16:55:51 +01:00
parent 1857cd9f3b
commit b41c4bd75c
2 changed files with 13 additions and 2 deletions
+9 -2
View File
@@ -280,9 +280,16 @@ export function UTCIForecast() {
// Synthesize a storm overlay (lightning) when the simulated hour is wet;
// outside playback keep the real active event.
const scopeEvent = simRow ? ((simRow.precip ?? 0) >= 4 ? { id: 'storm' } : null) : lensEvent;
// Local clock label for the playback button, e.g. "14:30".
// Local clock label for the playback button. The playback is a ROLLING 24h
// window from now, so it crosses into the next day — prefix the weekday
// (e.g. "Wed 14:30") so it's clear the scope has rolled past midnight and is
// showing tomorrow's hour, not today's table row for the same clock time.
const simClock = (playing && scopeDt)
? new Date(scopeDt.getTime() + utcOffsetMs).toISOString().slice(11, 16)
? (() => {
const d = new Date(scopeDt.getTime() + utcOffsetMs);
const wd = d.toLocaleDateString('en-GB', { weekday: 'short', timeZone: 'UTC' });
return `${wd} ${d.toISOString().slice(11, 16)}`;
})()
: null;
const staleThreshMs = isPro ? 15 * 60 * 1000 : 30 * 60 * 1000;
const isStale = fetchedAt ? (now - fetchedAt) > staleThreshMs : false;