subtask/ SW-683 Fixed params naming

This commit is contained in:
Hrishikesh Vaipurkar
2024-10-24 13:31:58 +02:00
parent 8fe4294bf9
commit d8c26b32bd
3 changed files with 14 additions and 9 deletions

View File

@@ -33,10 +33,10 @@ export default function MobileToggleButton({
? JSON.parse(decodeURIComponent(location))
: null
const nights = dt(d.to).diff(dt(d.from), "days")
const nights = dt(d.toDate).diff(dt(d.fromDate), "days")
const selectedFromDate = dt(d.from).locale(lang).format("D MMM")
const selectedToDate = dt(d.to).locale(lang).format("D MMM")
const selectedFromDate = dt(d.fromDate).locale(lang).format("D MMM")
const selectedToDate = dt(d.toDate).locale(lang).format("D MMM")
useEffect(() => {
setHasMounted(true)

View File

@@ -100,13 +100,21 @@ export default function DatePickerForm({ name = "date" }: DatePickerFormProps) {
close={close}
handleOnSelect={handleSelectDate}
locales={locales}
selectedDate={selectedDate}
// DayPicker lib needs Daterange in form as below to show appropriate UI
selectedDate={{
from: selectedDate.fromDate,
to: selectedDate.toDate,
}}
/>
<DatePickerMobile
close={close}
handleOnSelect={handleSelectDate}
locales={locales}
selectedDate={selectedDate}
// DayPicker lib needs Daterange in form as below to show appropriate UI
selectedDate={{
from: selectedDate.fromDate,
to: selectedDate.toDate,
}}
/>
</div>
</div>

View File

@@ -33,10 +33,7 @@ export default function Form({ locations, type }: BookingWidgetFormProps) {
const bookingFlowPage =
locationData.type == "cities" ? selectHotel[lang] : selectRate[lang]
const bookingWidgetParams = new URLSearchParams({
fromDate: data.date.from,
toDate: data.date.to,
})
const bookingWidgetParams = new URLSearchParams(data.date)
if (locationData.type == "cities")
bookingWidgetParams.set("city", locationData.name)