From 9041af2979db205850d5bbb7b8086b30cd732398 Mon Sep 17 00:00:00 2001 From: Daniel Rosel Date: Fri, 5 Dec 2025 11:45:16 +0100 Subject: [PATCH] chore: clean up product display in hotel and cleaner interfacing --- backend/server/app.py | 8 +++++- web/src/app/cart/page.tsx | 5 +++- web/src/components/feats/hotel/HotelCard.tsx | 3 +-- .../components/feats/hotel/HotelDetails.tsx | 8 +----- web/src/components/ui/DateInput.tsx | 26 +++++++++++++++++-- web/src/components/ui/Navigation.tsx | 4 +-- web/src/lib/hotel-utils.ts | 25 +++++++++++++++--- 7 files changed, 60 insertions(+), 19 deletions(-) diff --git a/backend/server/app.py b/backend/server/app.py index 482eee1..7190b19 100644 --- a/backend/server/app.py +++ b/backend/server/app.py @@ -290,8 +290,14 @@ async def get_products( query = supabase.table(table).select('*') # filter by exact date_index if provided + # dateIndex from frontend is days from today, convert to days since epoch if dateIndex is not None: - query = query.eq('date_index', dateIndex) + from datetime import datetime + epoch = datetime(1970, 1, 1) + today = datetime.now().replace(hour=0, minute=0, second=0, microsecond=0) + today_index = int((today - epoch).total_seconds() / 86400) + actual_date_index = today_index + dateIndex + query = query.eq('date_index', actual_date_index) response = query.execute() results = response.data diff --git a/web/src/app/cart/page.tsx b/web/src/app/cart/page.tsx index d487d40..30ac3f2 100644 --- a/web/src/app/cart/page.tsx +++ b/web/src/app/cart/page.tsx @@ -96,7 +96,10 @@ export default function CartPage() { ${total.toFixed(2)}