How to set dates in the search form

In a short search form the departure date is usually equal to the current date (unless you changed it in the settings). At the same time, in the extended search form, the date fields are empty by default. You can fix this by replacing depart_date and return_date with the following code:

 "depart_date": new Date().toISOString().slice(0, 10),
 "return_date": new Date(new Date().getTime()+(7*24*60*60*1000)).toISOString().slice(0, 10),

In this case the departure date will equivalent to the current date. And the date of return plus seven days.

Sample search form:

Was this article helpful?

Have more questions? Submit a request