()
| 364 | // --------------------------------------------------------------------------- |
| 365 | |
| 366 | async function refreshMeta() { |
| 367 | // Re-read on every refresh, so a page left open overnight moves on to the new day. |
| 368 | state.anchor = utcDay(Date.now()); |
| 369 | try { |
| 370 | const meta = await api('/api/meta'); |
| 371 | state.meta = meta; |
| 372 | if (meta.today) state.anchor = meta.today; |
| 373 | state.earliest = meta.earliest_day ?? null; |
| 374 | } catch { |
| 375 | // A meta failure is not fatal: the presets still end today and every panel |
| 376 | // still answers. The status line is what says so. |
| 377 | state.meta = null; |
| 378 | } |
| 379 | for (const input of document.querySelectorAll('.custom-range input')) input.max = state.anchor; |
| 380 | syncFilters(); |
| 381 | drawDataWarning(); |
| 382 | } |
| 383 | |
| 384 | const plural = (n, one, many) => `${n.toLocaleString('en-US')} ${n === 1 ? one : many}`; |
| 385 |
no test coverage detected