Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix: journey year helper takes what a journey row carries; PDF markdown test without casts

Mauricead4074f107d2
diff --git a/client/src/components/PDF/TripPDF.test.ts b/client/src/components/PDF/TripPDF.test.ts
index 950cae85a..6f33da5bb 100644
--- a/client/src/components/PDF/TripPDF.test.ts
+++ b/client/src/components/PDF/TripPDF.test.ts
@@ -401,9 +401,9 @@ describe('downloadTripPDF', () => {
it('FE-COMP-TRIPPDF-016c: renders markdown in a place description, sanitized', async () => {
const description = ['**Colosseum** tickets', '', '| Gate | Time |', '| --- | --- |', '| A | 9:00 |', '', '<script>alert(1)</script>'].join('\n')
const place = { ...placeWithDetails, description }
- const md = { ...richArgs, places: [place], assignments: { '10': [{ ...assignmentForDay, place }] } }
- await downloadTripPDF(md as any)
- const html = getIframe()!.srcdoc
+ const md = { ...richArgs, places: [place], assignments: { '10': [{ ...assignmentForDay, place }] } as typeof richArgs.assignments }
+ await downloadTripPDF(md)
+ const html = getIframe()?.srcdoc ?? ''
expect(html).toContain('<strong>Colosseum</strong>')
expect(html).toContain('<td>9:00</td>')
expect(html).not.toContain('**Colosseum**')
diff --git a/client/src/pages/journey/journeyModel.ts b/client/src/pages/journey/journeyModel.ts
index da2379dd8..0c1b26b5c 100644
--- a/client/src/pages/journey/journeyModel.ts
+++ b/client/src/pages/journey/journeyModel.ts
@@ -2,12 +2,12 @@
export function journeyYearLabel(journey: {
trip_date_min?: string | null;
trip_date_max?: string | null;
- created_at: string;
+ created_at?: string | null;
}): string {
// The dates are calendar dates, so the year is read from the text, not through a Date in some zone.
const from = journey.trip_date_min?.slice(0, 4);
const to = journey.trip_date_max?.slice(0, 4);
if (from && to && to !== from) return `${from}/${to}`;
if (from || to) return (from || to) as string;
- return String(new Date(journey.created_at).getFullYear());
+ return journey.created_at ? String(new Date(journey.created_at).getFullYear()) : '';
}