diff --git a/packages/booking-flow/lib/components/BookingConfirmation/index.tsx b/packages/booking-flow/lib/components/BookingConfirmation/index.tsx index a28fb0e15..905417806 100644 --- a/packages/booking-flow/lib/components/BookingConfirmation/index.tsx +++ b/packages/booking-flow/lib/components/BookingConfirmation/index.tsx @@ -2,13 +2,13 @@ import { notFound } from "next/navigation" import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert" import { dt } from "@scandic-hotels/common/dt" +import { hasOverlappingDates } from "@scandic-hotels/common/dt/utils/hasOverlappingDates" import { Alert } from "@scandic-hotels/design-system/Alert" import { Divider } from "@scandic-hotels/design-system/Divider" import { HotelTypeEnum } from "@scandic-hotels/trpc/enums/hotelType" import { BookingConfirmationProvider } from "../../providers/BookingConfirmationProvider" import { getBookingConfirmation } from "../../trpc/memoizedRequests/getBookingConfirmation" -import { filterOverlappingDates } from "../../utils/SelectRate" import { SidePanel } from "../SidePanel" import { Confirmation } from "./Confirmation" import { HotelDetails } from "./HotelDetails" @@ -46,7 +46,14 @@ export async function BookingConfirmation({ if (!room) { return notFound() } - + const validAlerts = hotel.specialAlerts.filter( + (alert) => + hasOverlappingDates( + alert, + dt(booking.checkInDate), + dt(booking.checkOutDate) + ) && alert.displayInBookingFlow + ) return ( - {filterOverlappingDates( - hotel.specialAlerts, - dt(booking.checkInDate), - dt(booking.checkOutDate) - ).map((alert) => ( + {validAlerts.map((alert) => (
- hasOverlappingDates(alert, dt(booking.fromDate), dt(booking.toDate)) + const validAlerts = hotelData.hotel.specialAlerts.filter( + (alert) => + hasOverlappingDates(alert, dt(booking.fromDate), dt(booking.toDate)) && + alert.displayInBookingFlow ) return (