mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-22 22:39:36 +02:00
Fix date handling in DateRangeCollapse and TransportationModal; improve hash change handling in +page.svelte
This commit is contained in:
parent
abc2d86dcf
commit
d9d754a87c
3 changed files with 18 additions and 8 deletions
|
@ -208,8 +208,8 @@
|
||||||
bind:checked={allDay}
|
bind:checked={allDay}
|
||||||
on:change={() => {
|
on:change={() => {
|
||||||
if (allDay) {
|
if (allDay) {
|
||||||
localStartDate = localStartDate.split('T')[0];
|
localStartDate = localStartDate ? localStartDate.split('T')[0] : '';
|
||||||
localEndDate = localEndDate.split('T')[0];
|
localEndDate = localEndDate ? localEndDate.split('T')[0] : '';
|
||||||
} else {
|
} else {
|
||||||
localStartDate = localStartDate + 'T00:00';
|
localStartDate = localStartDate + 'T00:00';
|
||||||
localEndDate = localEndDate + 'T23:59';
|
localEndDate = localEndDate + 'T23:59';
|
||||||
|
@ -405,7 +405,9 @@
|
||||||
<p class="text-sm text-base-content font-medium">
|
<p class="text-sm text-base-content font-medium">
|
||||||
{#if isAllDay(visit.start_date)}
|
{#if isAllDay(visit.start_date)}
|
||||||
<span class="badge badge-outline mr-2">{$t('adventures.all_day')}</span>
|
<span class="badge badge-outline mr-2">{$t('adventures.all_day')}</span>
|
||||||
{visit.start_date.split('T')[0]} – {visit.end_date.split('T')[0]}
|
{visit.start_date ? visit.start_date.split('T')[0] : ''} – {visit.end_date
|
||||||
|
? visit.end_date.split('T')[0]
|
||||||
|
: ''}
|
||||||
{:else if 'start_timezone' in visit}
|
{:else if 'start_timezone' in visit}
|
||||||
{formatDateInTimezone(visit.start_date, visit.start_timezone)} – {formatDateInTimezone(
|
{formatDateInTimezone(visit.start_date, visit.start_timezone)} – {formatDateInTimezone(
|
||||||
visit.end_date,
|
visit.end_date,
|
||||||
|
|
|
@ -41,6 +41,13 @@
|
||||||
end_timezone: transportationToEdit?.end_timezone || ''
|
end_timezone: transportationToEdit?.end_timezone || ''
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let startTimezone: string | undefined = transportation.start_timezone ?? undefined;
|
||||||
|
let endTimezone: string | undefined = transportation.end_timezone ?? undefined;
|
||||||
|
|
||||||
|
// Later, you should manually sync these back to `transportation` if needed
|
||||||
|
$: transportation.start_timezone = startTimezone ?? '';
|
||||||
|
$: transportation.end_timezone = endTimezone ?? '';
|
||||||
|
|
||||||
let starting_airport: string = '';
|
let starting_airport: string = '';
|
||||||
let ending_airport: string = '';
|
let ending_airport: string = '';
|
||||||
|
|
||||||
|
@ -345,8 +352,8 @@
|
||||||
type="transportation"
|
type="transportation"
|
||||||
bind:utcStartDate={transportation.date}
|
bind:utcStartDate={transportation.date}
|
||||||
bind:utcEndDate={transportation.end_date}
|
bind:utcEndDate={transportation.end_date}
|
||||||
bind:selectedStartTimezone={transportation.start_timezone}
|
bind:selectedStartTimezone={startTimezone}
|
||||||
bind:selectedEndTimezone={transportation.end_timezone}
|
bind:selectedEndTimezone={endTimezone}
|
||||||
{collection}
|
{collection}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
@ -300,7 +300,7 @@
|
||||||
function handleHashChange() {
|
function handleHashChange() {
|
||||||
const hash = window.location.hash.replace('#', '');
|
const hash = window.location.hash.replace('#', '');
|
||||||
if (hash) {
|
if (hash) {
|
||||||
currentView = hash
|
currentView = hash;
|
||||||
} else if (!collection.start_date) {
|
} else if (!collection.start_date) {
|
||||||
currentView = 'all';
|
currentView = 'all';
|
||||||
} else {
|
} else {
|
||||||
|
@ -308,7 +308,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeHash(event) {
|
function changeHash(event: any) {
|
||||||
window.location.hash = '#' + event.target.value;
|
window.location.hash = '#' + event.target.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -776,7 +776,8 @@
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if collection.id}
|
{#if collection.id}
|
||||||
<select class="select select-bordered border-primary md:hidden w-full"
|
<select
|
||||||
|
class="select select-bordered border-primary md:hidden w-full"
|
||||||
value={currentView}
|
value={currentView}
|
||||||
on:change={changeHash}
|
on:change={changeHash}
|
||||||
>
|
>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue