From a74a5242b8ea5205ef0672876b0d291c502f8384 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 3 Jul 2026 13:32:24 +0000 Subject: [PATCH] fix: use current date for slot availability + SW v56 --- public/service-worker.js | 4 ++-- src/pages/ClientDeliveryPage.jsx | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/public/service-worker.js b/public/service-worker.js index c8aad88..9c2ea0f 100644 --- a/public/service-worker.js +++ b/public/service-worker.js @@ -1,8 +1,8 @@ const isLocalhost = self.location.hostname === "localhost" || self.location.hostname === "127.0.0.1"; if (!isLocalhost) { - const STATIC_CACHE = "construction-delivery-static-v55"; - const RUNTIME_CACHE = "construction-delivery-runtime-v55"; + const STATIC_CACHE = "construction-delivery-static-v56"; + const RUNTIME_CACHE = "construction-delivery-runtime-v56"; const APP_SHELL_URLS = ["/", "/index.html", "/manifest.webmanifest", "/icons/icon-192.png", "/icons/icon-512.png"]; self.addEventListener("install", (event) => { diff --git a/src/pages/ClientDeliveryPage.jsx b/src/pages/ClientDeliveryPage.jsx index 00c8b77..6516198 100644 --- a/src/pages/ClientDeliveryPage.jsx +++ b/src/pages/ClientDeliveryPage.jsx @@ -241,6 +241,8 @@ export const ClientDeliveryPage = () => { () => (invitation?.smsSentAt ? new Date(invitation.smsSentAt) : new Date()), [token, invitation?.smsSentAt], ); + // For slot availability, always use current date — not SMS send date + const nowForSlots = React.useMemo(() => new Date(), []); // Fetch business schedule (delivery/pickup days) — no auth required React.useEffect(() => { @@ -310,7 +312,7 @@ export const ClientDeliveryPage = () => { }; }, [token]); - const slots = groupSlotsFromInvitation(invitation, referenceDate); + const slots = groupSlotsFromInvitation(invitation, nowForSlots); const invitationState = invitation?.state || "awaiting_choice"; const isActiveState = ["awaiting_choice", "opened", "reminder_sent"].includes(invitationState); @@ -357,7 +359,7 @@ export const ClientDeliveryPage = () => { setSelectedSlot( buildSelectedSlotFromInvitation( loadedInvitation, - groupSlotsFromInvitation(loadedInvitation, referenceDate), + groupSlotsFromInvitation(loadedInvitation, nowForSlots), ) || effectiveSelectedSlot, ); setChoiceSaved(true);