calendar: anchor week to current IST day on load

This commit is contained in:
Bhanu Prakash Sai Potteri 2026-06-01 16:01:17 +05:30
parent e97351b0fe
commit da28239019

View File

@ -129,8 +129,9 @@ export function CalendarView() {
if (cancelled) return;
setDrives(td);
setCars((c.records as unknown as Car[]) ?? []);
const todayKey = istDayKey(new Date().toISOString());
const days = td.map((r) => istDayKey(r.slot_start)).sort();
setWeekStart(days[0] ?? null);
setWeekStart(days.length ? todayKey : null);
})
.catch((e: any) => !cancelled && setError(e?.message ?? "Failed to load"))
.finally(() => !cancelled && setLoading(false));