From 6533cc8ce276a378547828476d44402ff1df1264 Mon Sep 17 00:00:00 2001 From: itskovacs Date: Sun, 2 Nov 2025 15:51:50 +0100 Subject: [PATCH] :lipstick: Trip creation daterange: user-friendly format --- src/src/app/components/trips/trips.component.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/src/app/components/trips/trips.component.ts b/src/src/app/components/trips/trips.component.ts index e107e1f..2dac90e 100644 --- a/src/src/app/components/trips/trips.component.ts +++ b/src/src/app/components/trips/trips.component.ts @@ -108,16 +108,13 @@ export class TripsComponent implements OnInit { generateTripDays(daterange: Date[]): Partial[] { const [from, to] = daterange; - const tripDays: Partial[] = []; - const sameMonth = from.getFullYear() === to.getFullYear() && from.getMonth() === to.getMonth(); - const months = ['Jan.', 'Feb.', 'Mar.', 'Apr.', 'May.', 'Jun.', 'Jul.', 'Aug.', 'Sep.', 'Oct.', 'Nov.', 'Dec.']; + const tripDays: Partial[] = []; const current = new Date(from); while (current <= to) { const day = current.getDate().toString().padStart(2, '0'); - const month = current.getMonth(); - const label = sameMonth ? `${day} ${months[month]}` : `${(month + 1).toString().padStart(2, '0')}/${day}`; + const label = `${day} ${months[current.getMonth()]}`; tripDays.push({ label, dt: current.toISOString().split('T')[0] }); current.setDate(current.getDate() + 1); }