fix: replace native date inputs with custom DateInput/DateTimeInput components

Native <input type='date'> and <input type='datetime-local'> render
their display format (mm/dd/yyyy vs dd/mm/yyyy, 12h vs 24h) based on
browser/OS locale, ignoring HTML lang attributes in Firefox and
inconsistently in Chrome. The previous lang=en-GB fix was unreliable.

Create DateInput.svelte and DateTimeInput.svelte components that show
dd/mm/yyyy (and DD/MM/YYYY HH:MM for datetime) by formatting the ISO
value in JS, while delegating the actual picker to a hidden native
input triggered via showPicker(). Supported in Chrome 99+, Firefox
101+, Safari 16+ (covers all modern browsers).

Updated 8 component files across CollectionModal, ChecklistModal,
NoteModal, ImmichSelect, CollectionMap, TransportationDetails,
LodgingDetails, and LocationVisits.
This commit is contained in:
2026-03-06 15:14:02 +00:00
parent 52299c1ff2
commit 04fb1dfb40
10 changed files with 218 additions and 79 deletions

View File

@@ -3,6 +3,7 @@
import { onMount } from 'svelte';
import { t } from 'svelte-i18n';
import MarkdownEditor from './MarkdownEditor.svelte';
import DateInput from '$lib/components/DateInput.svelte';
import { addToast } from '$lib/toasts';
import { copyToClipboard } from '$lib/index';
import type { Collection, ContentImage, SlimCollection } from '$lib/types';
@@ -343,12 +344,10 @@
{$t('adventures.start_date')}
</span>
</label>
<input
type="date"
<DateInput
id="start_date"
name="start_date"
bind:value={collection.start_date}
class="input input-bordered w-full"
/>
</div>
@@ -360,12 +359,10 @@
{$t('adventures.end_date')}
</span>
</label>
<input
type="date"
<DateInput
id="end_date"
name="end_date"
bind:value={collection.end_date}
class="input input-bordered w-full"
/>
</div>