1

we need help converting an input from date type to text type with dd/mm/yyyy format, the thing is that the params are sent by url so they need to be as text, the thing is we can not convert it and pass the value to params

This is the code that we are using, to send info, but we want to set input types to date so we can see the calendar

`

<div class="container">
<form class="horizontal" action="https://homirent.cloudbeds.com/#/" method="get">
<p class="p1"> City: <select name="city">
<option value="all">All Cities</option>
<option>Cancún</option>
<option>Ciudad De México</option>
<option>Santiago De Querétaro</option>
</select>
Check-In:
<input type="text" name="check_in" placeholder="01/01/2023"/>
Check-Out:
<input type="text" name="check_out" placeholder="02/01/2023"/>
  <input type="submit" /> </p>
</form>
</div>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script>
$("form").on( "submit", function( event ) {
event.preventDefault();
var params = $(this).serialize();
params = params.replaceAll('+', ' ');
var url = $(this).attr('action');
url = url+'?'+params;
window.location.href = url;
});
</script>

we have this implementation but we cant make it function

`var checkin params.substring( params.indexOf("checkin=")+7, 10) // ten digits date
var checkout params.substring( params.indexOf("checkout=")+7, 10) // ten digits date
Convert checkin and checkout to dd/mm/yyyy (this article may help https://stackoverflow.com/questions/5619202/parsing-a-string-to-a-date-in-javascript)
Then adding params = params.substring(0,x) + checking + checkout (see article https://myfrontdesk.cloudbeds.com/hc/en-us/articles/219624748?input_string=widget+for+mygroups) ==> actual URL formt is https://$association_portal_url/#/?city=$city&check_in=$check_in&check_out=$check_out` 
Pablo Bora
  • 15
  • 3

0 Answers0