diff --git a/client/src/components/Dashboard/useDashboardTimezones.test.ts b/client/src/components/Dashboard/useDashboardTimezones.test.ts
index c2fb01c13..b5580930f 100644
--- a/client/src/components/Dashboard/useDashboardTimezones.test.ts
+++ b/client/src/components/Dashboard/useDashboardTimezones.test.ts
@@ -1,4 +1,4 @@
-// FE-COMP-TZHOOK-001 to -007: the world clocks both dashboards share.
+// FE-COMP-TZHOOK-001 to -009: the world clocks both dashboards share.
import { act, renderHook, waitFor } from '@testing-library/react';
import { useSettingsStore } from '../../store/settingsStore';
@@ -97,4 +97,27 @@ describe('useDashboardTimezones', () => {
expect(localStorage.getItem('trek_dashboard_tz')).toBeNull();
expect(updateSetting).not.toHaveBeenCalled();
});
+
+ // #2694: Chrome on Windows names no zone for a system zone it cannot map.
+ it('FE-COMP-TZHOOK-008: a browser that names no zone still gets the default clocks', () => {
+ const original = Intl.DateTimeFormat.prototype.resolvedOptions;
+ const spy = vi.spyOn(Intl.DateTimeFormat.prototype, 'resolvedOptions').mockImplementation(function (
+ this: Intl.DateTimeFormat
+ ) {
+ return { ...original.call(this), timeZone: undefined as unknown as string };
+ });
+ try {
+ const { result } = renderHook(() => useDashboardTimezones('en'));
+ expect(result.current.zones).toEqual(['Europe/London', 'Asia/Tokyo']);
+ expect(() => result.current.zones.map((tz) => result.current.timeIn(tz))).not.toThrow();
+ } finally {
+ spy.mockRestore();
+ }
+ });
+
+ it('FE-COMP-TZHOOK-009: a stored zone this browser does not know is left out instead of crashing the clocks', () => {
+ seedSettings(['Europe/Berlin', 'Mars/Olympus_Mons', '']);
+ const { result } = renderHook(() => useDashboardTimezones('en'));
+ expect(result.current.zones).toEqual(['Europe/Berlin']);
+ });
});
diff --git a/client/src/components/Dashboard/useDashboardTimezones.ts b/client/src/components/Dashboard/useDashboardTimezones.ts
index bc7ca6d3d..a2da83bb0 100644
--- a/client/src/components/Dashboard/useDashboardTimezones.ts
+++ b/client/src/components/Dashboard/useDashboardTimezones.ts
@@ -1,6 +1,7 @@
import { useEffect, useMemo, useState } from 'react';
import { useSettingsStore } from '../../store/settingsStore';
+import { browserTimeZone, isValidTimeZone } from '../../utils/localDate';
const DEFAULT_ZONES = ['Europe/London', 'Asia/Tokyo'];
@@ -38,13 +39,15 @@ export function shortZone(tz: string): string {
* clocks tick every 30 seconds, `adding` toggles the zone picker.
*/
export function useDashboardTimezones(locale: string) {
- const home = Intl.DateTimeFormat().resolvedOptions().timeZone;
+ const home = browserTimeZone();
const [now, setNow] = useState(() => new Date());
const isLoaded = useSettingsStore((s) => s.isLoaded);
const updateSetting = useSettingsStore((s) => s.updateSetting);
const stored = useSettingsStore((s) => s.settings.dashboard_timezones);
// Unset (never chosen) falls back to home + defaults; an explicit list is honoured.
- const zones = stored ?? [home, ...DEFAULT_ZONES];
+ // A browser that names no zone (#2694) or a zone this browser does not know
+ // would throw while rendering a clock, so such entries are left out.
+ const zones = (stored ?? [home, ...DEFAULT_ZONES]).filter(isValidTimeZone);
const setZones = (next: string[]) => {
updateSetting('dashboard_timezones', next).catch(() => {});
};
diff --git a/client/src/components/PDF/TripPDF.test.ts b/client/src/components/PDF/TripPDF.test.ts
index 1d2c4c5ce..5d010a344 100644
--- a/client/src/components/PDF/TripPDF.test.ts
+++ b/client/src/components/PDF/TripPDF.test.ts
@@ -397,6 +397,24 @@ describe('downloadTripPDF', () => {
expect(iframe!.srcdoc).toContain('€')
})
+ // #2692: a place's description and notes print as the planner shows them, not as raw markdown.
+ it('FE-COMP-TRIPPDF-016c: renders markdown in a place description, sanitized', async () => {
+ const place = { ...placeWithDetails, description: '**Colosseum** tickets
+
+| Gate | Time |
+| --- | --- |
+| A | 9:00 |
+
+' }
+ const md = { ...richArgs, places: [place], assignments: { '10': [{ ...assignmentForDay, place }] } }
+ await downloadTripPDF(md as any)
+ const html = getIframe()!.srcdoc
+ expect(html).toContain('Colosseum')
+ expect(html).toContain('
9:00 | ')
+ expect(html).not.toContain('**Colosseum**')
+ expect(html).not.toContain('')
+ })
+
it('FE-COMP-TRIPPDF-016b: formats price chip and totals in the trip currency, not EUR', async () => {
const usdArgs = {
...richArgs,
@@ -796,7 +814,7 @@ describe('downloadTripPDF remaining branches', () => {
}]))
const html = srcdoc()
- expect(html).toContain('ICE 599 · Gl. 7 · Seat 21A · FRA → BER')
+ expect(html).toContain('ICE 599 · reservations.meta.platform 7 · reservations.meta.seat 21A · FRA → BER')
})
it('FE-W5PDF-006: a multi-leg train renders one line per leg', async () => {
@@ -811,7 +829,7 @@ describe('downloadTripPDF remaining branches', () => {
}]))
const html = srcdoc()
- expect(html).toContain('IC 1 · Gl. 3 · BER → MUC')
+ expect(html).toContain('IC 1 · reservations.meta.platform 3 · BER → MUC')
expect(html).toContain('EC 2 · MUC → ZRH')
})
diff --git a/client/src/components/PDF/TripPDF.tsx b/client/src/components/PDF/TripPDF.tsx
index a4691f793..6bbbe2805 100644
--- a/client/src/components/PDF/TripPDF.tsx
+++ b/client/src/components/PDF/TripPDF.tsx
@@ -24,6 +24,7 @@ import { fetchExchangeRates } from '../../hooks/useExchangeRates'
import { getFlightLegs, getTrainLegs, usesStationRoute } from '../../utils/flightLegs'
import { isServiceStopType } from '../Roadtrip/roadtripModel'
import { onlyMyPlan } from './pdfScope'
+import { createMarkdownHtml } from '../shared/SafeMarkdown'
/**
* Every day starts a new page by default. On a trip of short days that prints
@@ -231,6 +232,10 @@ export async function downloadTripPDF({ trip, days, places, assignments: allStor
let hasTransportNotes = false
const loc = _locale || undefined
const tr = _t || (k => k)
+ // A place's description and notes are markdown in the app, so the export renders
+ // them the same way instead of printing the raw syntax (#2692).
+ const markdown = createMarkdownHtml()
+ const mdBlock = (text: string) => ``
// The store read is the fallback, not the source: a caller that forgets the
// prop still prints the reader's own format instead of silently reverting.
const is12h = (_timeFormat || useSettingsStore.getState().settings.time_format || '24h') === '12h'
@@ -439,8 +444,8 @@ export async function downloadTripPDF({ trip, days, places, assignments: allStor
const source = (usesStationRoute(r.type) ? getTrainLegs(r) : getFlightLegs(r))[l.index]
subtitleLines = [[
l.airline, l.flight_number, l.train_number,
- l.platform ? `Gl. ${l.platform}` : '',
- l.seat ? `Seat ${l.seat}` : '',
+ l.platform ? `${tr('reservations.meta.platform')} ${l.platform}` : '',
+ l.seat ? `${tr('reservations.meta.seat')} ${l.seat}` : '',
(l.from || l.to) ? [l.from, l.to].filter(Boolean).join(' → ') : '',
source?.confirmation_number,
].filter(Boolean).join(' · ')].filter(Boolean)
@@ -471,7 +476,7 @@ export async function downloadTripPDF({ trip, days, places, assignments: allStor
// Multi-leg: one line per leg so every train number + segment route shows,
// with the segment's own booking code where it has one (#1943).
subtitleLines = legs.map(l =>
- [l.train_number, l.platform ? `Gl. ${l.platform}` : '',
+ [l.train_number, l.platform ? `${tr('reservations.meta.platform')} ${l.platform}` : '',
(l.from || l.to) ? [l.from, l.to].filter(Boolean).join(' → ') : '',
l.confirmation_number]
.filter(Boolean).join(' · '))
@@ -479,7 +484,7 @@ export async function downloadTripPDF({ trip, days, places, assignments: allStor
} else {
const stops = (r.endpoints || []).slice().sort((a, b) => (a.sequence ?? 0) - (b.sequence ?? 0)).map(e => e.code || e.name)
const route = stops.length >= 2 ? stops.join(' → ') : ''
- subtitle = [meta.train_number, meta.platform ? `Gl. ${meta.platform}` : '', meta.seat ? `Seat ${meta.seat}` : '', route].filter(Boolean).join(' · ')
+ subtitle = [meta.train_number, meta.platform ? `${tr('reservations.meta.platform')} ${meta.platform}` : '', meta.seat ? `${tr('reservations.meta.seat')} ${meta.seat}` : '', route].filter(Boolean).join(' · ')
}
}
else if (r.type === 'car') {
@@ -587,10 +592,10 @@ export async function downloadTripPDF({ trip, days, places, assignments: allStor
${place.address ? `${svgPin}${escHtml(place.address)}
` : ''}
${(place.lat != null && place.lng != null) ? `${Number(place.lat).toFixed(5)}, ${Number(place.lng).toFixed(5)}
` : ''}
- ${place.description ? `${escHtml(place.description)}
` : ''}
+ ${place.description ? mdBlock(place.description) : ''}
${chips ? `${chips}
` : ''}
- ${place.notes ? `${escHtml(place.notes)}
` : ''}
- ${item.data.notes ? `${escHtml(item.data.notes)}
` : ''}
+ ${place.notes ? mdBlock(place.notes) : ''}
+ ${item.data.notes ? mdBlock(item.data.notes) : ''}
`
}).join('')
@@ -836,7 +841,17 @@ export async function downloadTripPDF({ trip, days, places, assignments: allStor
.info-spacer { width: 13px; flex-shrink: 0; }
.info-text { font-size: 9px; color: #64748b; line-height: 1.5; }
.info-text.muted { color: #94a3b8; }
- .info-text.italic { font-style: italic; }
+ .info-text.md { min-width: 0; overflow-wrap: anywhere; }
+ .md > :first-child { margin-top: 0; }
+ .md > :last-child { margin-bottom: 0; }
+ .md p, .md ul, .md ol, .md table, .md blockquote, .md pre { margin: 0 0 4px; }
+ .md ul, .md ol { padding-left: 14px; }
+ .md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { font-size: 10px; font-weight: 700; color: #475569; margin: 4px 0 2px; }
+ .md table { border-collapse: collapse; }
+ .md th, .md td { border: 1px solid #e2e8f0; padding: 2px 5px; text-align: left; }
+ .md code { font-family: ui-monospace, monospace; font-size: 8.5px; }
+ .md a { color: inherit; text-decoration: underline; }
+ .md blockquote { border-left: 2px solid #e2e8f0; padding-left: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; padding-left: 21px; margin-top: 4px; }
.chip { display: inline-flex; align-items: center; gap: 3px; font-size: 8px; font-weight: 600; background: #f1f5f9; color: #374151; border-radius: 99px; padding: 2px 7px; white-space: nowrap; }
@@ -930,6 +945,7 @@ ${tripMapHtml}
${daysHtml}
${pluginSectionsHtml}