fix: show replacement dates as dd/mm/yyyy

This commit is contained in:
Davide Scaini
2026-05-24 14:01:53 +02:00
parent bdee036204
commit 94cd3f7eb4
+6 -1
View File
@@ -83,6 +83,11 @@
const GEAR_ICONS: Record<string, string> = { bike: '🚲', shoes: '👟', skis: '🎿', other: '⚙️' };
function fmtDate(iso: string): string {
const [y, m, d] = iso.split('-');
return `${d}/${m}/${y}`;
}
const PART_SUGGESTIONS: Record<string, { name: string; threshold_km: number }> = {
bike: { name: 'chain', threshold_km: 3000 },
shoes: { name: 'running shoes', threshold_km: 750 },
@@ -751,7 +756,7 @@
<div class="pl-2 space-y-0.5">
{#each part.replacements.slice().reverse().slice(0, 3) as rep (rep.id)}
<div class="flex items-center gap-2 text-xs text-zinc-600">
<span>{rep.date}</span>
<span>{fmtDate(rep.date)}</span>
{#if rep.note}<span class="text-zinc-500">{rep.note}</span>{/if}
<button
on:click={() => deleteReplacement(item.id, part.id, rep.id)}