fixes date timezone bug

This commit is contained in:
Christian Beutel
2024-04-05 19:42:03 +02:00
parent 50ffd35307
commit bbbc4f38b6
8 changed files with 94 additions and 8 deletions

View File

@@ -8,9 +8,15 @@ export async function GET(event: RequestEvent) {
try {
const r = await pb.collection('trails')
.getOne<Trail>(event.params.id as string, { expand: expand ?? "" })
// remove time from dates
r.date = r.date?.substring(0, 10) ?? ""
for (const log of r.expand?.summit_logs ?? []) {
log.date = log.date.substring(0, 10)
}
return json(r)
} catch (e: any) {
throw error(e.status, e);
} catch (e: any) {
throw error(e.status || 500, e);
}
}