fix: use current date for slot availability + SW v56

This commit is contained in:
root 2026-07-03 13:32:24 +00:00
parent e93215f837
commit a74a5242b8
2 changed files with 6 additions and 4 deletions

View File

@ -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) => {

View File

@ -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);