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)) ? JSON.parse(decodeURIComponent(location))
: null : 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 selectedFromDate = dt(d.fromDate).locale(lang).format("D MMM")
const selectedToDate = dt(d.to).locale(lang).format("D MMM") const selectedToDate = dt(d.toDate).locale(lang).format("D MMM")
useEffect(() => { useEffect(() => {
setHasMounted(true) setHasMounted(true)

View File

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

View File

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