From 7442bd70cd9ee8d3f0d838ed24b449c430d9204c Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Tue, 6 May 2025 14:38:31 -0400 Subject: [PATCH] Update version to 0.9.0, add DateRangeDropdown component, enhance LodgingModal with price step, and add invalid date range message --- frontend/package.json | 2 +- .../lib/components/DateRangeDropdown.svelte | 172 ++++++++++++++++++ .../src/lib/components/LodgingModal.svelte | 1 + frontend/src/locales/en.json | 1 + frontend/src/routes/datetest/+page.svelte | 13 ++ 5 files changed, 188 insertions(+), 1 deletion(-) create mode 100644 frontend/src/lib/components/DateRangeDropdown.svelte create mode 100644 frontend/src/routes/datetest/+page.svelte diff --git a/frontend/package.json b/frontend/package.json index 96dd929..2d3d3e0 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "adventurelog-frontend", - "version": "0.8.0", + "version": "0.9.0", "scripts": { "dev": "vite dev", "django": "cd .. && cd backend/server && python3 manage.py runserver", diff --git a/frontend/src/lib/components/DateRangeDropdown.svelte b/frontend/src/lib/components/DateRangeDropdown.svelte new file mode 100644 index 0000000..608d8bd --- /dev/null +++ b/frontend/src/lib/components/DateRangeDropdown.svelte @@ -0,0 +1,172 @@ + + +
+ +
+ {$t('adventures.date_information')} +
+
+ +
+ +
+ + +
+ +
+ + + + + {#if collection && collection.start_date && collection.end_date} + + {/if} +
+ + + {#if localStartDate} +
+ + + +
+ {/if} +
+ + + {#if !validateDateRange(localStartDate, localEndDate).valid} + + {/if} + + +
+
diff --git a/frontend/src/lib/components/LodgingModal.svelte b/frontend/src/lib/components/LodgingModal.svelte index d91155c..9a2975e 100644 --- a/frontend/src/lib/components/LodgingModal.svelte +++ b/frontend/src/lib/components/LodgingModal.svelte @@ -323,6 +323,7 @@ id="price" name="price" bind:value={lodging.price} + step="0.01" class="input input-bordered w-full max-w-xs mt-1" /> diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json index 65c7288..20e2e90 100644 --- a/frontend/src/locales/en.json +++ b/frontend/src/locales/en.json @@ -62,6 +62,7 @@ "collection_remove_success": "Adventure removed from collection successfully!", "collection_remove_error": "Error removing adventure from collection", "collection_link_success": "Adventure linked to collection successfully!", + "invalid_date_range": "Invalid date range", "no_image_found": "No image found", "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.", diff --git a/frontend/src/routes/datetest/+page.svelte b/frontend/src/routes/datetest/+page.svelte new file mode 100644 index 0000000..b06ba1f --- /dev/null +++ b/frontend/src/routes/datetest/+page.svelte @@ -0,0 +1,13 @@ + + + + +

{new Date(utcStartDate).toLocaleString()} - {new Date(utcEndDate).toLocaleString()}

+ +

UTC Start Date: {utcStartDate}

+

UTC End Date: {utcEndDate}