animation strip

This commit is contained in:
Vincent van der Wal
2026-08-01 17:13:44 +02:00
parent d7fe0bafc8
commit 49e011c20b
5 changed files with 47 additions and 21 deletions
@@ -185,9 +185,9 @@
const target = Date.parse(`${param}T12:00:00Z`);
if (Number.isNaN(target)) return;
const today = new Date();
today.setUTCHours(12, 0, 0, 0);
const offset = Math.round((target - today.getTime()) / 86_400_000);
const now = new Date();
const todayNoon = Date.UTC(now.getFullYear(), now.getMonth(), now.getDate(), 12);
const offset = Math.round((target - todayNoon) / 86_400_000);
if (offset < -3 || offset > 15) return; // out of reach: stay on today
wantedDay = param;
@@ -215,7 +215,7 @@
const isToday = fetchedDaily
? dayKey === formatZoned(new Date(), fetchedDaily.timezone, 'yyyy-MM-dd')
: false;
syncSearchParams($page.url, {
syncSearchParams(get(page).url, {
day: isToday ? null : dayKey,
model: model && model !== 'best_match' ? model : null
});