mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-06 13:45:17 +02:00
Update date validation to use UTC comparison and enhance documentation
This commit is contained in:
commit
8b41a0f5a4
13 changed files with 43 additions and 18 deletions
|
@ -182,6 +182,7 @@
|
||||||
<!-- Dual timezone selectors for transportation -->
|
<!-- Dual timezone selectors for transportation -->
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
<div>
|
<div>
|
||||||
|
<!-- svelte-ignore a11y-label-has-associated-control -->
|
||||||
<label class="text-sm font-medium block mb-1">
|
<label class="text-sm font-medium block mb-1">
|
||||||
{$t('adventures.departure_timezone')}
|
{$t('adventures.departure_timezone')}
|
||||||
</label>
|
</label>
|
||||||
|
@ -189,6 +190,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
<!-- svelte-ignore a11y-label-has-associated-control -->
|
||||||
<label class="text-sm font-medium block mb-1">
|
<label class="text-sm font-medium block mb-1">
|
||||||
{$t('adventures.arrival_timezone')}
|
{$t('adventures.arrival_timezone')}
|
||||||
</label>
|
</label>
|
||||||
|
@ -366,8 +368,8 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Validation Message -->
|
<!-- Validation Message -->
|
||||||
{#if !validateDateRange(localStartDate, localEndDate).valid}
|
{#if !validateDateRange(utcStartDate ?? '', utcEndDate ?? '').valid}
|
||||||
<div role="alert" class="alert alert-error">
|
<div role="alert" class="alert alert-error mt-2">
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
class="h-6 w-6 shrink-0 stroke-current"
|
class="h-6 w-6 shrink-0 stroke-current"
|
||||||
|
|
|
@ -87,10 +87,10 @@ export function updateUTCDate({
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate date ranges
|
* Validate date ranges using UTC comparison
|
||||||
* @param startDate - Start date string
|
* @param startDate - Start date string in UTC (ISO format)
|
||||||
* @param endDate - End date string
|
* @param endDate - End date string in UTC (ISO format)
|
||||||
* @returns Object with validation result and error message
|
* @returns Object with validation result and optional error message
|
||||||
*/
|
*/
|
||||||
export function validateDateRange(
|
export function validateDateRange(
|
||||||
startDate: string,
|
startDate: string,
|
||||||
|
@ -106,11 +106,12 @@ export function validateDateRange(
|
||||||
if (
|
if (
|
||||||
startDate &&
|
startDate &&
|
||||||
endDate &&
|
endDate &&
|
||||||
DateTime.fromISO(startDate).toMillis() > DateTime.fromISO(endDate).toMillis()
|
DateTime.fromISO(startDate, { zone: 'utc' }).toMillis() >
|
||||||
|
DateTime.fromISO(endDate, { zone: 'utc' }).toMillis()
|
||||||
) {
|
) {
|
||||||
return {
|
return {
|
||||||
valid: false,
|
valid: false,
|
||||||
error: 'Start date must be before end date'
|
error: 'Start date must be before end date (based on UTC)'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -259,7 +259,9 @@
|
||||||
"timezone": "Zeitzone",
|
"timezone": "Zeitzone",
|
||||||
"no_visits": "Keine Besuche",
|
"no_visits": "Keine Besuche",
|
||||||
"arrival_timezone": "Ankunftszeitzone",
|
"arrival_timezone": "Ankunftszeitzone",
|
||||||
"departure_timezone": "Abfahrtszeit"
|
"departure_timezone": "Abfahrtszeit",
|
||||||
|
"arrival_date": "Ankunftsdatum",
|
||||||
|
"departure_date": "Abflugdatum"
|
||||||
},
|
},
|
||||||
"home": {
|
"home": {
|
||||||
"desc_1": "Entdecken, planen und erkunden Sie mühelos",
|
"desc_1": "Entdecken, planen und erkunden Sie mühelos",
|
||||||
|
|
|
@ -67,6 +67,8 @@
|
||||||
"no_visits": "No visits",
|
"no_visits": "No visits",
|
||||||
"departure_timezone": "Departure Timezone",
|
"departure_timezone": "Departure Timezone",
|
||||||
"arrival_timezone": "Arrival Timezone",
|
"arrival_timezone": "Arrival Timezone",
|
||||||
|
"departure_date": "Departure Date",
|
||||||
|
"arrival_date": "Arrival Date",
|
||||||
"no_image_found": "No image found",
|
"no_image_found": "No image found",
|
||||||
"collection_link_error": "Error linking adventure to collection",
|
"collection_link_error": "Error linking adventure to collection",
|
||||||
"adventure_delete_confirm": "Are you sure you want to delete this adventure? This action cannot be undone.",
|
"adventure_delete_confirm": "Are you sure you want to delete this adventure? This action cannot be undone.",
|
||||||
|
|
|
@ -307,7 +307,9 @@
|
||||||
"timezone": "Zona horaria",
|
"timezone": "Zona horaria",
|
||||||
"no_visits": "No hay visitas",
|
"no_visits": "No hay visitas",
|
||||||
"arrival_timezone": "Zona horaria de llegada",
|
"arrival_timezone": "Zona horaria de llegada",
|
||||||
"departure_timezone": "Zona horaria de salida"
|
"departure_timezone": "Zona horaria de salida",
|
||||||
|
"arrival_date": "Fecha de llegada",
|
||||||
|
"departure_date": "Fecha de salida"
|
||||||
},
|
},
|
||||||
"worldtravel": {
|
"worldtravel": {
|
||||||
"all": "Todo",
|
"all": "Todo",
|
||||||
|
|
|
@ -259,7 +259,9 @@
|
||||||
"timezone": "Fuseau horaire",
|
"timezone": "Fuseau horaire",
|
||||||
"no_visits": "Pas de visites",
|
"no_visits": "Pas de visites",
|
||||||
"arrival_timezone": "Fuseau horaire d'arrivée",
|
"arrival_timezone": "Fuseau horaire d'arrivée",
|
||||||
"departure_timezone": "Fuseau horaire de départ"
|
"departure_timezone": "Fuseau horaire de départ",
|
||||||
|
"arrival_date": "Date d'arrivée",
|
||||||
|
"departure_date": "Date de départ"
|
||||||
},
|
},
|
||||||
"home": {
|
"home": {
|
||||||
"desc_1": "Découvrez, planifiez et explorez en toute simplicité",
|
"desc_1": "Découvrez, planifiez et explorez en toute simplicité",
|
||||||
|
|
|
@ -259,7 +259,9 @@
|
||||||
"timezone": "Fuso orario",
|
"timezone": "Fuso orario",
|
||||||
"no_visits": "Nessuna visita",
|
"no_visits": "Nessuna visita",
|
||||||
"arrival_timezone": "Fuso orario di arrivo",
|
"arrival_timezone": "Fuso orario di arrivo",
|
||||||
"departure_timezone": "Fuso orario di partenza"
|
"departure_timezone": "Fuso orario di partenza",
|
||||||
|
"arrival_date": "Data di arrivo",
|
||||||
|
"departure_date": "Data di partenza"
|
||||||
},
|
},
|
||||||
"home": {
|
"home": {
|
||||||
"desc_1": "Scopri, pianifica ed esplora con facilità",
|
"desc_1": "Scopri, pianifica ed esplora con facilità",
|
||||||
|
|
|
@ -259,7 +259,9 @@
|
||||||
"timezone": "시간대",
|
"timezone": "시간대",
|
||||||
"no_visits": "방문 없음",
|
"no_visits": "방문 없음",
|
||||||
"arrival_timezone": "도착 시간대",
|
"arrival_timezone": "도착 시간대",
|
||||||
"departure_timezone": "출발 시간대"
|
"departure_timezone": "출발 시간대",
|
||||||
|
"arrival_date": "도착 날짜",
|
||||||
|
"departure_date": "출발 날짜"
|
||||||
},
|
},
|
||||||
"auth": {
|
"auth": {
|
||||||
"both_passwords_required": "두 암호 모두 필요합니다",
|
"both_passwords_required": "두 암호 모두 필요합니다",
|
||||||
|
|
|
@ -259,7 +259,9 @@
|
||||||
"timezone": "Tijdzone",
|
"timezone": "Tijdzone",
|
||||||
"no_visits": "Geen bezoeken",
|
"no_visits": "Geen bezoeken",
|
||||||
"arrival_timezone": "Aankomsttijdzone",
|
"arrival_timezone": "Aankomsttijdzone",
|
||||||
"departure_timezone": "Vertrektijdzone"
|
"departure_timezone": "Vertrektijdzone",
|
||||||
|
"arrival_date": "Aankomstdatum",
|
||||||
|
"departure_date": "Vertrekdatum"
|
||||||
},
|
},
|
||||||
"home": {
|
"home": {
|
||||||
"desc_1": "Ontdek, plan en verken met gemak",
|
"desc_1": "Ontdek, plan en verken met gemak",
|
||||||
|
|
|
@ -307,7 +307,9 @@
|
||||||
"timezone": "Tidssone",
|
"timezone": "Tidssone",
|
||||||
"no_visits": "Ingen besøk",
|
"no_visits": "Ingen besøk",
|
||||||
"arrival_timezone": "Ankomst tidssone",
|
"arrival_timezone": "Ankomst tidssone",
|
||||||
"departure_timezone": "Avgangstidssone"
|
"departure_timezone": "Avgangstidssone",
|
||||||
|
"arrival_date": "Ankomstdato",
|
||||||
|
"departure_date": "Avgangsdato"
|
||||||
},
|
},
|
||||||
"worldtravel": {
|
"worldtravel": {
|
||||||
"country_list": "Liste over land",
|
"country_list": "Liste over land",
|
||||||
|
|
|
@ -307,7 +307,9 @@
|
||||||
"timezone": "Strefa czasowa",
|
"timezone": "Strefa czasowa",
|
||||||
"no_visits": "Brak wizyt",
|
"no_visits": "Brak wizyt",
|
||||||
"arrival_timezone": "Strefa czasowa przyjazdu",
|
"arrival_timezone": "Strefa czasowa przyjazdu",
|
||||||
"departure_timezone": "Strefa czasowa odlotu"
|
"departure_timezone": "Strefa czasowa odlotu",
|
||||||
|
"arrival_date": "Data przyjazdu",
|
||||||
|
"departure_date": "Data wyjazdu"
|
||||||
},
|
},
|
||||||
"worldtravel": {
|
"worldtravel": {
|
||||||
"country_list": "Lista krajów",
|
"country_list": "Lista krajów",
|
||||||
|
|
|
@ -259,7 +259,9 @@
|
||||||
"timezone": "Tidszon",
|
"timezone": "Tidszon",
|
||||||
"no_visits": "Inga besök",
|
"no_visits": "Inga besök",
|
||||||
"arrival_timezone": "Ankomsttidszon",
|
"arrival_timezone": "Ankomsttidszon",
|
||||||
"departure_timezone": "Avgångstidszon"
|
"departure_timezone": "Avgångstidszon",
|
||||||
|
"arrival_date": "Ankomstdatum",
|
||||||
|
"departure_date": "Avgångsdatum"
|
||||||
},
|
},
|
||||||
"home": {
|
"home": {
|
||||||
"desc_1": "Upptäck, planera och utforska med lätthet",
|
"desc_1": "Upptäck, planera och utforska med lätthet",
|
||||||
|
|
|
@ -307,7 +307,9 @@
|
||||||
"timezone": "时区",
|
"timezone": "时区",
|
||||||
"no_visits": "没有访问",
|
"no_visits": "没有访问",
|
||||||
"arrival_timezone": "到达时区",
|
"arrival_timezone": "到达时区",
|
||||||
"departure_timezone": "离开时区"
|
"departure_timezone": "离开时区",
|
||||||
|
"arrival_date": "到达日期",
|
||||||
|
"departure_date": "出发日期"
|
||||||
},
|
},
|
||||||
"auth": {
|
"auth": {
|
||||||
"forgot_password": "忘记密码?",
|
"forgot_password": "忘记密码?",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue