Merged in fix/BOOK-662-handle-overlapping-dates-timezone (pull request #3319)

Fix/BOOK-662 handle overlapping dates timezone

* fix(BOOK-662): handle overlapping dates alerts

* fix(BOOK-662): handle overlapping dates alerts

* fix(BOOK-662): add test same dates


Approved-by: Anton Gunnarsson
This commit is contained in:
Bianca Widstam
2025-12-19 14:03:30 +00:00
parent 3ac8956926
commit 57d0e1b27b
7 changed files with 57 additions and 94 deletions

View File

@@ -2,7 +2,6 @@ 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"
@@ -10,6 +9,7 @@ import { HotelTypeEnum } from "@scandic-hotels/trpc/enums/hotelType"
import { env } from "../../../env/server"
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"
@@ -50,14 +50,12 @@ export async function BookingConfirmation({
if (!room) {
return notFound()
}
const validAlerts = hotel.specialAlerts.filter(
(alert) =>
hasOverlappingDates(
alert,
dt(booking.checkInDate),
dt(booking.checkOutDate)
) && alert.displayInBookingFlow
const validAlerts = filterOverlappingDates(
hotel.specialAlerts.filter((alert) => alert.displayInBookingFlow),
dt.utc(booking.checkInDate),
dt.utc(booking.checkOutDate)
)
return (
<BookingConfirmationProvider
bookingCode={booking.bookingCode}

View File

@@ -2,10 +2,10 @@ import { cookies } from "next/headers"
import { FamilyAndFriendsCodes } from "@scandic-hotels/common/constants/familyAndFriends"
import { dt } from "@scandic-hotels/common/dt"
import { hasOverlappingDates } from "@scandic-hotels/common/dt/utils/hasOverlappingDates"
import { HotelInfoCard } from "@scandic-hotels/design-system/HotelInfoCard"
import { mapApiImagesToGalleryImages } from "../../misc/imageGallery"
import { filterOverlappingDates } from "../../utils/SelectRate"
import FnFNotAllowedAlert from "../FnFNotAllowedAlert"
import { HotelDetailsSidePeek } from "../HotelDetailsSidePeek"
import { AmenitiesSidePeekLabel } from "./AmenititesSidePeekLabel"
@@ -33,10 +33,10 @@ export async function SelectRate({
isInValidFNF = cookieStore.get("sc")?.value !== "1"
}
const validAlerts = hotelData.hotel.specialAlerts.filter(
(alert) =>
hasOverlappingDates(alert, dt(booking.fromDate), dt(booking.toDate)) &&
alert.displayInBookingFlow
const validAlerts = filterOverlappingDates(
hotelData.hotel.specialAlerts.filter((alert) => alert.displayInBookingFlow),
dt.utc(booking.fromDate),
dt.utc(booking.toDate)
)
return (