Calculating correct duration, leadtime etc depending on dates
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { differenceInCalendarDays,isWeekend } from "date-fns"
|
||||
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { selectHotelMap } from "@/constants/routes/hotelReservation"
|
||||
|
||||
@@ -29,6 +31,8 @@ export default async function SelectHotelPage({
|
||||
setLang(params.lang)
|
||||
|
||||
const tempSearchTerm = "Stockholm"
|
||||
const tempArrivalDate = new Date("2024-10-25")
|
||||
const tempDepartureDate = new Date("2024-10-25")
|
||||
const intl = await getIntl()
|
||||
|
||||
const hotels = await fetchAvailableHotels({
|
||||
@@ -52,15 +56,15 @@ export default async function SelectHotelPage({
|
||||
const hotelsTrackingData: TrackingSDKHotelInfo = {
|
||||
availableResults: hotels.length,
|
||||
searchTerm: tempSearchTerm,
|
||||
arrivalDate: new Date("2025-05-02"),
|
||||
departureDate: new Date("2025-05-03"),
|
||||
noOfAdults: 1,
|
||||
noOfChildren: 0,
|
||||
noOfRooms: 1,
|
||||
duration: 1,
|
||||
leadTime: 187,
|
||||
searchType: "hotel",
|
||||
bookingTypeofDay: "weekend",
|
||||
arrivalDate: tempArrivalDate,
|
||||
departureDate: tempDepartureDate,
|
||||
noOfAdults: 1, // TODO: Use values from searchParams
|
||||
noOfChildren: 0, // TODO: Use values from searchParams
|
||||
noOfRooms: 1, // TODO: Use values from searchParams
|
||||
duration: differenceInCalendarDays(tempDepartureDate, tempArrivalDate),
|
||||
leadTime: differenceInCalendarDays(tempArrivalDate, new Date()),
|
||||
searchType: "destination",
|
||||
bookingTypeofDay: isWeekend(tempArrivalDate) ? "weekend" : "weekday",
|
||||
country: hotels[0].hotelData.address.country,
|
||||
region: hotels[0].hotelData.address.city,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user