1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-23 23:09:37 +02:00

feat: Add current timezone and airport description fields to localization files

This commit is contained in:
Sean Morley 2025-02-22 17:00:40 -05:00
parent ea36b104b6
commit d80805a181
11 changed files with 158 additions and 40 deletions

View file

@ -18,10 +18,14 @@
let fullEndDate: string = ''; let fullEndDate: string = '';
// Format date as local datetime // Format date as local datetime
// Convert an ISO date to a datetime-local value in local time.
function toLocalDatetime(value: string | null): string { function toLocalDatetime(value: string | null): string {
if (!value) return ''; if (!value) return '';
const date = new Date(value); const date = new Date(value);
return date.toISOString().slice(0, 16); // Format: YYYY-MM-DDTHH:mm // Adjust the time by subtracting the timezone offset.
date.setMinutes(date.getMinutes() - date.getTimezoneOffset());
// Return format YYYY-MM-DDTHH:mm
return date.toISOString().slice(0, 16);
} }
type LodgingType = { type LodgingType = {
@ -111,7 +115,17 @@
return; return;
} }
// Create or update hotel // Only convert to UTC if the time is still in local format.
if (lodging.check_in && !lodging.check_in.includes('Z')) {
// new Date(lodging.check_in) interprets the input as local time.
lodging.check_in = new Date(lodging.check_in).toISOString();
}
if (lodging.check_out && !lodging.check_out.includes('Z')) {
lodging.check_out = new Date(lodging.check_out).toISOString();
}
console.log(lodging.check_in, lodging.check_out);
// Create or update lodging...
const url = lodging.id === '' ? '/api/lodging' : `/api/lodging/${lodging.id}`; const url = lodging.id === '' ? '/api/lodging' : `/api/lodging/${lodging.id}`;
const method = lodging.id === '' ? 'POST' : 'PATCH'; const method = lodging.id === '' ? 'POST' : 'PATCH';
const res = await fetch(url, { const res = await fetch(url, {
@ -354,24 +368,45 @@
</div> </div>
</div> </div>
<!-- End Date --> <!-- End Date -->
{#if lodging.check_out} <div>
<label for="end_date">
{$t('lodging.check_out')}
</label>
<div> <div>
<label for="end_date"> <input
{$t('lodging.check_out')} type="datetime-local"
</label> id="end_date"
<div> name="end_date"
<input min={constrainDates ? lodging.check_in : ''}
type="datetime-local" max={constrainDates ? fullEndDate : ''}
id="end_date" bind:value={lodging.check_out}
name="end_date" class="input input-bordered w-full max-w-xs mt-1"
min={constrainDates ? lodging.check_in : ''} />
max={constrainDates ? fullEndDate : ''}
bind:value={lodging.check_out}
class="input input-bordered w-full max-w-xs mt-1"
/>
</div>
</div> </div>
{/if} </div>
<div role="alert" class="alert shadow-lg bg-neutral mt-4">
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
class="stroke-info h-6 w-6 shrink-0"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
></path>
</svg>
<span>
{$t('lodging.current_timezone')}:
{(() => {
const tz = new Intl.DateTimeFormat().resolvedOptions().timeZone;
const [continent, city] = tz.split('/');
return `${continent} (${city.replace('_', ' ')})`;
})()}
</span>
</div>
</div> </div>
</div> </div>

View file

@ -334,7 +334,7 @@
"not_visited": "Nicht besucht", "not_visited": "Nicht besucht",
"num_countries": "Länder gefunden", "num_countries": "Länder gefunden",
"partially_visited": "Teilweise besucht", "partially_visited": "Teilweise besucht",
"all_visited": "Sie haben alle Regionen besucht in", "all_visited": "Sie haben alle Regionen besucht in",
"cities": "Städte", "cities": "Städte",
"failed_to_mark_visit": "Der Besuch konnte nicht markiert werden", "failed_to_mark_visit": "Der Besuch konnte nicht markiert werden",
"failed_to_remove_visit": "Der Besuch von konnte nicht entfernt werden", "failed_to_remove_visit": "Der Besuch von konnte nicht entfernt werden",
@ -498,7 +498,10 @@
"provide_start_date": "Bitte geben Sie ein Startdatum an", "provide_start_date": "Bitte geben Sie ein Startdatum an",
"start": "Start", "start": "Start",
"to_location": "Zum Standort", "to_location": "Zum Standort",
"transport_type": "Transporttyp" "transport_type": "Transporttyp",
"ending_airport_desc": "Geben Sie den Ending Airport Code ein (z. B. lax)",
"fetch_location_information": "Standortinformationen abrufen",
"starting_airport_desc": "Geben Sie den Start -Flughafencode ein (z. B. JFK)"
}, },
"search": { "search": {
"adventurelog_results": "AdventureLog-Ergebnisse", "adventurelog_results": "AdventureLog-Ergebnisse",
@ -612,6 +615,7 @@
"resort": "Resort", "resort": "Resort",
"start": "Start", "start": "Start",
"type": "Typ", "type": "Typ",
"villa": "Villa" "villa": "Villa",
"current_timezone": "Aktuelle Zeitzone"
} }
} }

View file

@ -530,7 +530,8 @@
"villa": "Villa", "villa": "Villa",
"motel": "Motel", "motel": "Motel",
"other": "Other", "other": "Other",
"reservation_number": "Reservation Number" "reservation_number": "Reservation Number",
"current_timezone": "Current Timezone"
}, },
"search": { "search": {
"adventurelog_results": "AdventureLog Results", "adventurelog_results": "AdventureLog Results",

View file

@ -498,7 +498,10 @@
"flight_number": "Número de vuelo", "flight_number": "Número de vuelo",
"from_location": "Desde la ubicación", "from_location": "Desde la ubicación",
"transportation_added": "¡Transporte agregado exitosamente!", "transportation_added": "¡Transporte agregado exitosamente!",
"transportation_delete_error": "Error al eliminar el transporte" "transportation_delete_error": "Error al eliminar el transporte",
"ending_airport_desc": "Ingrese el código de aeropuerto final (por ejemplo, LAX)",
"fetch_location_information": "Información de ubicación para obtener",
"starting_airport_desc": "Ingrese el código de aeropuerto inicial (por ejemplo, JFK)"
}, },
"search": { "search": {
"adventurelog_results": "Resultados del registro de aventuras", "adventurelog_results": "Resultados del registro de aventuras",
@ -612,6 +615,7 @@
"start": "Comenzar", "start": "Comenzar",
"type": "Tipo", "type": "Tipo",
"villa": "Villa", "villa": "Villa",
"edit_lodging": "Editar alojamiento" "edit_lodging": "Editar alojamiento",
"current_timezone": "Zona horaria"
} }
} }

View file

@ -498,7 +498,10 @@
"transportation_added": "Transport ajouté avec succès !", "transportation_added": "Transport ajouté avec succès !",
"transportation_delete_error": "Erreur lors de la suppression du transport", "transportation_delete_error": "Erreur lors de la suppression du transport",
"transportation_deleted": "Transport supprimé avec succès !", "transportation_deleted": "Transport supprimé avec succès !",
"transportation_edit_success": "Transport modifié avec succès !" "transportation_edit_success": "Transport modifié avec succès !",
"ending_airport_desc": "Entrez la fin du code aéroportuaire (par exemple, laxiste)",
"fetch_location_information": "Récupérer les informations de localisation",
"starting_airport_desc": "Entrez le code aéroport de démarrage (par exemple, JFK)"
}, },
"search": { "search": {
"adventurelog_results": "Résultats du journal d'aventure", "adventurelog_results": "Résultats du journal d'aventure",
@ -612,6 +615,7 @@
"resort": "Station balnéaire", "resort": "Station balnéaire",
"start": "Commencer", "start": "Commencer",
"type": "Taper", "type": "Taper",
"villa": "Villa" "villa": "Villa",
"current_timezone": "Fuseau horaire actuel"
} }
} }

View file

@ -498,7 +498,10 @@
"transportation_delete_error": "Errore durante l'eliminazione del trasporto", "transportation_delete_error": "Errore durante l'eliminazione del trasporto",
"transportation_deleted": "Trasporto eliminato con successo!", "transportation_deleted": "Trasporto eliminato con successo!",
"transportation_edit_success": "Trasporti modificati con successo!", "transportation_edit_success": "Trasporti modificati con successo!",
"type": "Tipo" "type": "Tipo",
"ending_airport_desc": "Immettere il codice aeroportuale finale (ad es. LAX)",
"fetch_location_information": "Informazioni sulla posizione di recupero",
"starting_airport_desc": "Immettere il codice dell'aeroporto di partenza (ad es. JFK)"
}, },
"search": { "search": {
"adventurelog_results": "Risultati di AdventureLog", "adventurelog_results": "Risultati di AdventureLog",
@ -612,6 +615,7 @@
"lodging_deleted": "Alloggio eliminato con successo!", "lodging_deleted": "Alloggio eliminato con successo!",
"lodging_edit_success": "Alloggio modificato con successo!", "lodging_edit_success": "Alloggio modificato con successo!",
"lodging_type": "Tipo di alloggio", "lodging_type": "Tipo di alloggio",
"motel": "Motel" "motel": "Motel",
"current_timezone": "Fuso orario attuale"
} }
} }

View file

@ -234,7 +234,19 @@
"will_be_marked": "모험이 저장되면 방문했다고 표시합니다.", "will_be_marked": "모험이 저장되면 방문했다고 표시합니다.",
"checklists": "체크리스트", "checklists": "체크리스트",
"cities_updated": "도시 업데이트됨", "cities_updated": "도시 업데이트됨",
"clear": "초기화" "clear": "초기화",
"city": "도시",
"delete_lodging": "숙박을 삭제하십시오",
"display_name": "표시 이름",
"location_details": "위치 세부 사항",
"lodging": "하숙",
"lodging_delete_confirm": "이 숙소 위치를 삭제 하시겠습니까? \n이 조치는 취소 할 수 없습니다.",
"lodging_information": "숙박 정보",
"of": "~의",
"price": "가격",
"region": "지역",
"reservation_number": "예약 번호",
"welcome_map_info": "이 서버의 공개 모험"
}, },
"auth": { "auth": {
"both_passwords_required": "두 암호 모두 필요합니다", "both_passwords_required": "두 암호 모두 필요합니다",
@ -255,7 +267,11 @@
"registration_disabled": "현재 등록할 수 없습니다.", "registration_disabled": "현재 등록할 수 없습니다.",
"reset_failed": "비밀번호 재설정 실패", "reset_failed": "비밀번호 재설정 실패",
"signup": "가입", "signup": "가입",
"username": "사용자 이름" "username": "사용자 이름",
"no_public_adventures": "공개 모험이 발견되지 않았습니다",
"no_public_collections": "공개 컬렉션이 발견되지 않았습니다",
"user_adventures": "사용자 모험",
"user_collections": "사용자 수집"
}, },
"categories": { "categories": {
"category_name": "카테고리 이름", "category_name": "카테고리 이름",
@ -382,7 +398,8 @@
"northernLights": "Northern Lights" "northernLights": "Northern Lights"
}, },
"users": "사용자", "users": "사용자",
"worldtravel": "세계 여행" "worldtravel": "세계 여행",
"admin_panel": "관리자 패널"
}, },
"notes": { "notes": {
"add_a_link": "링크 추가", "add_a_link": "링크 추가",
@ -538,7 +555,10 @@
"transportation_delete_error": "교통수단 삭제 오류", "transportation_delete_error": "교통수단 삭제 오류",
"transportation_deleted": "교통수단이 성공적으로 삭제되었습니다!", "transportation_deleted": "교통수단이 성공적으로 삭제되었습니다!",
"transportation_edit_success": "교통수단이 성공적으로 편집되었습니다!", "transportation_edit_success": "교통수단이 성공적으로 편집되었습니다!",
"type": "유형" "type": "유형",
"ending_airport_desc": "엔드 공항 코드 입력 (예 : LAX)",
"fetch_location_information": "위치 정보를 가져 오십시오",
"starting_airport_desc": "공항 시작 코드 입력 (예 : JFK)"
}, },
"users": { "users": {
"no_users_found": "공개 프로필인 사용자가 없습니다." "no_users_found": "공개 프로필인 사용자가 없습니다."
@ -566,5 +586,35 @@
"view_cities": "도시 보기", "view_cities": "도시 보기",
"visit_remove_failed": "방문 표시 제거 실패", "visit_remove_failed": "방문 표시 제거 실패",
"visit_to": "방문함" "visit_to": "방문함"
},
"lodging": {
"apartment": "아파트",
"bnb": "숙박 및 아침 식사",
"cabin": "선실",
"campground": "캠프장",
"check_in": "체크인",
"current_timezone": "현재 시간대",
"date_and_time": "날짜",
"edit": "편집하다",
"edit_lodging": "숙박 편집",
"error_editing_lodging": "오류 편집 숙소",
"hostel": "숙박소",
"hotel": "호텔",
"house": "집",
"lodging_added": "숙박이 성공적으로 추가되었습니다!",
"lodging_delete_error": "오류 삭제 숙박",
"lodging_deleted": "숙박 시설이 성공적으로 삭제되었습니다!",
"lodging_edit_success": "숙박이 성공적으로 편집되었습니다!",
"lodging_type": "숙박 유형",
"motel": "모텔",
"new_lodging": "새로운 숙박",
"other": "다른",
"provide_start_date": "시작 날짜를 제공하십시오",
"reservation_number": "예약 번호",
"resort": "의지",
"start": "시작",
"type": "유형",
"villa": "별장",
"check_out": "체크 아웃"
} }
} }

View file

@ -498,7 +498,10 @@
"transport_type": "Vervoerstype", "transport_type": "Vervoerstype",
"transportation_added": "Vervoer succesvol toegevoegd!", "transportation_added": "Vervoer succesvol toegevoegd!",
"transportation_delete_error": "Fout bij verwijderen vervoer", "transportation_delete_error": "Fout bij verwijderen vervoer",
"transportation_deleted": "Vervoer succesvol verwijderd!" "transportation_deleted": "Vervoer succesvol verwijderd!",
"ending_airport_desc": "Voer eindigende luchthavencode in (bijv. LAX)",
"fetch_location_information": "Locatie -informatie ophalen",
"starting_airport_desc": "Voer de startende luchthavencode in (bijv. JFK)"
}, },
"search": { "search": {
"adventurelog_results": "AdventureLog-resultaten", "adventurelog_results": "AdventureLog-resultaten",
@ -612,6 +615,7 @@
"resort": "Toevlucht", "resort": "Toevlucht",
"start": "Begin", "start": "Begin",
"type": "Type", "type": "Type",
"villa": "Villa" "villa": "Villa",
"current_timezone": "Huidige tijdzone"
} }
} }

View file

@ -498,7 +498,10 @@
"transportation_edit_success": "Transport edytowany pomyślnie!", "transportation_edit_success": "Transport edytowany pomyślnie!",
"edit_transportation": "Edytuj transport", "edit_transportation": "Edytuj transport",
"start": "Początek", "start": "Początek",
"date_and_time": "Data i godzina" "date_and_time": "Data i godzina",
"ending_airport_desc": "Wprowadź końcowe kod lotniska (np. LAX)",
"fetch_location_information": "Pobierać informacje o lokalizacji",
"starting_airport_desc": "Wprowadź początkowy kod lotniska (np. JFK)"
}, },
"search": { "search": {
"adventurelog_results": "Wyniki AdventureLog", "adventurelog_results": "Wyniki AdventureLog",
@ -612,6 +615,7 @@
"other": "Inny", "other": "Inny",
"provide_start_date": "Proszę podać datę rozpoczęcia", "provide_start_date": "Proszę podać datę rozpoczęcia",
"reservation_number": "Numer rezerwacji", "reservation_number": "Numer rezerwacji",
"resort": "Uciec" "resort": "Uciec",
"current_timezone": "Obecna strefa czasowa"
} }
} }

View file

@ -498,7 +498,10 @@
"transportation_delete_error": "Det gick inte att ta bort transport", "transportation_delete_error": "Det gick inte att ta bort transport",
"transportation_deleted": "Transporten har raderats!", "transportation_deleted": "Transporten har raderats!",
"transportation_edit_success": "Transporten har redigerats!", "transportation_edit_success": "Transporten har redigerats!",
"type": "Typ" "type": "Typ",
"ending_airport_desc": "Ange slut på flygplatskoden (t.ex. LAX)",
"fetch_location_information": "Hämta platsinformation",
"starting_airport_desc": "Ange start av flygplatskoden (t.ex. JFK)"
}, },
"search": { "search": {
"adventurelog_results": "AdventureLog-resultat", "adventurelog_results": "AdventureLog-resultat",
@ -612,6 +615,7 @@
"check_out": "Checka ut", "check_out": "Checka ut",
"date_and_time": "Datum", "date_and_time": "Datum",
"edit": "Redigera", "edit": "Redigera",
"edit_lodging": "Redigera logi" "edit_lodging": "Redigera logi",
"current_timezone": "Nuvarande tidszon"
} }
} }

View file

@ -498,7 +498,10 @@
"transportation_delete_error": "删除交通时出错", "transportation_delete_error": "删除交通时出错",
"transportation_deleted": "交通删除成功!", "transportation_deleted": "交通删除成功!",
"transportation_edit_success": "交通编辑成功!", "transportation_edit_success": "交通编辑成功!",
"type": "类型" "type": "类型",
"ending_airport_desc": "输入结束机场代码例如LAX",
"fetch_location_information": "获取位置信息",
"starting_airport_desc": "输入启动机场代码(例如肯尼迪国际机构)"
}, },
"search": { "search": {
"adventurelog_results": "冒险日志结果", "adventurelog_results": "冒险日志结果",
@ -612,6 +615,7 @@
"other": "其他", "other": "其他",
"provide_start_date": "请提供开始日期", "provide_start_date": "请提供开始日期",
"reservation_number": "预订号", "reservation_number": "预订号",
"resort": "采取" "resort": "采取",
"current_timezone": "当前时区"
} }
} }