calendar: anchor week to current IST day on load
This commit is contained in:
parent
e97351b0fe
commit
da28239019
@ -129,8 +129,9 @@ export function CalendarView() {
|
|||||||
if (cancelled) return;
|
if (cancelled) return;
|
||||||
setDrives(td);
|
setDrives(td);
|
||||||
setCars((c.records as unknown as Car[]) ?? []);
|
setCars((c.records as unknown as Car[]) ?? []);
|
||||||
|
const todayKey = istDayKey(new Date().toISOString());
|
||||||
const days = td.map((r) => istDayKey(r.slot_start)).sort();
|
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"))
|
.catch((e: any) => !cancelled && setError(e?.message ?? "Failed to load"))
|
||||||
.finally(() => !cancelled && setLoading(false));
|
.finally(() => !cancelled && setLoading(false));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user