I am using a form for check-in and check-out dates. For that, I am using jquery date range picker
but it is only allowing me to choose 'mm/dd/yy' date format but I want to submit my form with 'dd M yy' date format. Please help.
$( function() {
var dateFormat = "mm/dd/yy",
from = $( "#check_in_date_view" )
.datepicker({
defaultDate: "+1w",
changeMonth: false,
numberOfMonths: 1
})
.on( "change", function() {
to.datepicker( "option", "minDate", getDate( this ) );
}),
to = $( "#check_out_date_view" ).datepicker({
defaultDate: "+1w",
changeMonth: false,
numberOfMonths: 1
})
.on( "change", function() {
from.datepicker( "option", "maxDate", getDate( this ) );
});
function getDate( element ) {
var date;
try {
date = $.datepicker.parseDate( dateFormat, element.value );
} catch( error ) {
date = null;
}
return date;
}
} );
<script src="https://dkgzabag3frbh.cloudfront.net/assets/public-fe4a9982b5d5f02ccf3ae1e703aba2c0.js"></script>
<form class="formtastic" id="booking-form" target="_blank" action="http://example.com" accept-charset="UTF-8" method="get"><input name="utf8" type="hidden" value="✓" />
<input type="hidden" name="locale" id="locale" value="en" />
<input type="hidden" name="from_widget" id="from_widget" value="true" />
<fieldset class='inputs'>
<ol>
<li class='string'>
<label >Check In Date</label>
<input type="text" name="check_in_date_view" id="check_in_date_view" class="calendar" data-init-val="null" />
<input type="hidden" name="check_in_date" id="check_in_date" />
</li>
<li class='string'>
<label>Check Out Date</label>
<input type="text" name="check_out_date_view" id="check_out_date_view" class="calendar" data-init-val="null" />
<input type="hidden" name="check_out_date" id="check_out_date" />
</li>
</ol>
</fieldset>
<fieldset class='actions'>
<ol>
<input name="booking" type="submit" class="check_availability" onClick="return handleClick('')" value="Book Now" />
</ol>
</fieldset>
</form>