fix: enforce dd/mm/yyyy, 24h time, and locale-aware location search

- Replace all 'en-US' and undefined locales with 'en-GB' in date
  formatting across 15+ frontend files (dateUtils.ts, cards, routes,
  Luxon calls) to consistently output day-first dates and 24h times
- Set hour12: false in all Intl.DateTimeFormat and toLocaleDateString
  calls that previously used 12h format
- Pass user's svelte-i18n locale as &lang= query param from
  LocationSearchMap and LocationQuickStart to the reverse-geocode API
- Extract lang param in reverse_geocode_view and forward to both
  search_osm and search_google
- Add Accept-Language header to Nominatim requests so searches return
  results in the user's language (e.g. Prague not Praha)
- Add languageCode field to Google Places API payload for same effect
This commit is contained in:
2026-03-06 13:50:27 +00:00
parent df8d1adf15
commit f55b0ea230
27 changed files with 302 additions and 190 deletions

View File

@@ -147,17 +147,17 @@
// Helper functions
function formatDateInTimezone(utcDate: string, timezone: string): string {
try {
return new Intl.DateTimeFormat(undefined, {
return new Intl.DateTimeFormat('en-GB', {
timeZone: timezone,
year: 'numeric',
month: 'short',
day: 'numeric',
hour: '2-digit',
minute: '2-digit',
hour12: true
hour12: false
}).format(new Date(utcDate));
} catch {
return new Date(utcDate).toLocaleString();
return new Date(utcDate).toLocaleString('en-GB');
}
}
@@ -957,8 +957,8 @@
{formatDateInTimezone(visit.start_date, visit.timezone)}
{formatDateInTimezone(visit.end_date, visit.timezone)}
{:else}
{new Date(visit.start_date).toLocaleString()}
{new Date(visit.end_date).toLocaleString()}
{new Date(visit.start_date).toLocaleString('en-GB')}
{new Date(visit.end_date).toLocaleString('en-GB')}
{/if}
</div>
</div>