From eecd2794a0719664f2a4e662214ac6e9898fe43b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=20Jurmanovi=C4=87?= Date: Thu, 29 May 2025 01:06:43 +0200 Subject: [PATCH] fix date formatting --- src/routes/dashboard/server/[id]/+page.server.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/routes/dashboard/server/[id]/+page.server.ts b/src/routes/dashboard/server/[id]/+page.server.ts index a532f7d..3c5ecfc 100644 --- a/src/routes/dashboard/server/[id]/+page.server.ts +++ b/src/routes/dashboard/server/[id]/+page.server.ts @@ -6,18 +6,16 @@ import { redirect } from '@sveltejs/kit'; import type { RequestEvent } from '@sveltejs/kit'; import { configFile, type Config, type Session } from '$models/config'; import { set } from 'lodash-es'; -import { format } from 'date-fns-tz'; -import { subDays } from 'date-fns'; +import { subDays, formatISO } from 'date-fns'; export const load = async (event: RequestEvent) => { const isAuth = await checkAuth(event); if (!isAuth) return redirect(308, '/login'); if (!event.params.id) return redirect(308, '/dashboard'); - const today = format(new Date(), 'yyyy-MM-ddTHH:mm:ssZ'); - const thirtyDaysAgo = format(subDays(new Date(), 30), 'yyyy-MM-ddTHH:mm:ssZ'); + const today = new Date(); + const endDate = formatISO(today); + const startDate = formatISO(subDays(today, 30)); - const endDate = today; - const startDate = thirtyDaysAgo; const [server, configs, tracks, stateHistory] = await Promise.all([ getServerById(event, event.params.id), getConfigFiles(event, event.params.id),