innercontext/frontend/src/routes/routines/+page.server.ts
Piotr Oleszczyk 853019075d fix: remove AM/PM filter from routines, add keyed each blocks
Remove the All/AM/PM filter buttons and part_of_day param from
the routines list page — date-based sorting/filtering is preferred.

Add missing keyed {#each} blocks across all pages to follow
Svelte 5 best practice (dashboard, products, medications,
lab results, routines list and detail, skin).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 12:57:56 +01:00

14 lines
441 B
TypeScript

import { getRoutines } from '$lib/api';
import type { PageServerLoad } from './$types';
export const load: PageServerLoad = async ({ url }) => {
const from_date = url.searchParams.get('from_date') ?? recentDate(30);
const routines = await getRoutines({ from_date });
return { routines };
};
function recentDate(daysAgo: number): string {
const d = new Date();
d.setDate(d.getDate() - daysAgo);
return d.toISOString().slice(0, 10);
}