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:
@@ -333,7 +333,7 @@
|
||||
}
|
||||
|
||||
function formatDate(dateString: string): string {
|
||||
return new Date(dateString).toLocaleDateString();
|
||||
return new Date(dateString).toLocaleDateString('en-GB');
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -684,7 +684,7 @@
|
||||
|
||||
function formatDate(dateString: string | null) {
|
||||
if (!dateString) return '';
|
||||
return DateTime.fromISO(dateString).toLocaleString(DateTime.DATE_MED);
|
||||
return DateTime.fromISO(dateString).toLocaleString(DateTime.DATE_MED, { locale: 'en-GB' });
|
||||
}
|
||||
|
||||
function collaboratorDisplayName(person: Collaborator | null | undefined): string {
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
}
|
||||
|
||||
function formatDate(dateString: string): string {
|
||||
return new Date(dateString).toLocaleDateString();
|
||||
return new Date(dateString).toLocaleDateString('en-GB');
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
|
||||
@@ -528,22 +528,24 @@
|
||||
<div class="text-sm">
|
||||
{#if visit.timezone}
|
||||
<strong>{$t('adventures.start')}:</strong>
|
||||
{DateTime.fromISO(visit.start_date, { zone: 'utc' })
|
||||
.setZone(visit.timezone)
|
||||
.toLocaleString(DateTime.DATETIME_MED)}<br />
|
||||
<strong>{$t('adventures.end')}:</strong>
|
||||
{DateTime.fromISO(visit.end_date, { zone: 'utc' })
|
||||
.setZone(visit.timezone)
|
||||
.toLocaleString(DateTime.DATETIME_MED)}
|
||||
{:else}
|
||||
<strong>Start:</strong>
|
||||
{DateTime.fromISO(visit.start_date).toLocaleString(
|
||||
DateTime.DATETIME_MED
|
||||
)}<br />
|
||||
<strong>End:</strong>
|
||||
{DateTime.fromISO(visit.end_date).toLocaleString(
|
||||
DateTime.DATETIME_MED
|
||||
)}
|
||||
{DateTime.fromISO(visit.start_date, { zone: 'utc' })
|
||||
.setZone(visit.timezone)
|
||||
.toLocaleString(DateTime.DATETIME_MED, { locale: 'en-GB' })}<br />
|
||||
<strong>{$t('adventures.end')}:</strong>
|
||||
{DateTime.fromISO(visit.end_date, { zone: 'utc' })
|
||||
.setZone(visit.timezone)
|
||||
.toLocaleString(DateTime.DATETIME_MED, { locale: 'en-GB' })}
|
||||
{:else}
|
||||
<strong>Start:</strong>
|
||||
{DateTime.fromISO(visit.start_date).toLocaleString(
|
||||
DateTime.DATETIME_MED,
|
||||
{ locale: 'en-GB' }
|
||||
)}<br />
|
||||
<strong>End:</strong>
|
||||
{DateTime.fromISO(visit.end_date).toLocaleString(
|
||||
DateTime.DATETIME_MED,
|
||||
{ locale: 'en-GB' }
|
||||
)}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -900,7 +902,7 @@
|
||||
{#each adventure.sun_times as sun_time}
|
||||
<div class="border-l-4 border-warning pl-3">
|
||||
<div class="font-semibold text-sm">
|
||||
{new Date(sun_time.date).toLocaleDateString()}
|
||||
{new Date(sun_time.date).toLocaleDateString('en-GB')}
|
||||
</div>
|
||||
<div class="text-xs opacity-70">
|
||||
{$t('adventures.sunrise')}: {sun_time.sunrise} • {$t('adventures.sunset')}: {sun_time.sunset}
|
||||
|
||||
@@ -101,7 +101,9 @@
|
||||
if (!dateStr || isAllDay(dateStr)) return null;
|
||||
const dt = DateTime.fromISO(dateStr, { zone: timezone ?? 'UTC' });
|
||||
if (!dt.isValid) return null;
|
||||
return dt.setZone(localTimeZone).toLocaleString(DateTime.DATETIME_MED);
|
||||
return dt.setZone(localTimeZone).toLocaleString(DateTime.DATETIME_MED, {
|
||||
locale: 'en-GB'
|
||||
});
|
||||
};
|
||||
|
||||
const inLocal = formatLocal(checkIn);
|
||||
|
||||
@@ -333,12 +333,12 @@
|
||||
<div class="flex items-center justify-center gap-2 text-base-content/60">
|
||||
<Calendar class="w-5 h-5" />
|
||||
<span class="text-lg">
|
||||
{$t('profile.member_since')}
|
||||
{new Date(user.date_joined).toLocaleDateString(undefined, {
|
||||
timeZone: 'UTC',
|
||||
year: 'numeric',
|
||||
month: 'long'
|
||||
})}
|
||||
{$t('profile.member_since')}
|
||||
{new Date(user.date_joined).toLocaleDateString('en-GB', {
|
||||
timeZone: 'UTC',
|
||||
year: 'numeric',
|
||||
month: 'long'
|
||||
})}
|
||||
</span>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -263,7 +263,9 @@
|
||||
if (!dateStr || isAllDay(dateStr)) return null;
|
||||
const dt = DateTime.fromISO(dateStr, { zone: zone ?? 'UTC' });
|
||||
if (!dt.isValid) return null;
|
||||
return dt.setZone(localTimeZone).toLocaleString(DateTime.DATETIME_MED);
|
||||
return dt.setZone(localTimeZone).toLocaleString(DateTime.DATETIME_MED, {
|
||||
locale: 'en-GB'
|
||||
});
|
||||
};
|
||||
|
||||
const startLocal = formatLocal(start, startTimezone);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
<div class="flex justify-center mt-4">
|
||||
<p class="text-sm text-neutral-content">
|
||||
{user.date_joined ? 'Joined ' + new Date(user.date_joined).toLocaleDateString() : ''}
|
||||
{user.date_joined ? 'Joined ' + new Date(user.date_joined).toLocaleDateString('en-GB') : ''}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user