I am trying to get the date range "from" and "to" to add it to my DB. I use altFormat and altField to write the date in DB format (yy-mm-dd) when displaying the normal date format in the user interface using the jQuery Datepicker user interface component.
My question is: how to use this in a Datepicker user interface range. Where can I specify altField for my from and to datepickers?
http://jqueryui.com/demos/datepicker/#date-range
My code is:
var dates = $( "#hotel_display_checkin_date, #hotel_display_checkout_date" ).datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 1,
altFormat: "yy-mm-dd",
altField: "#hotel_checkin_date",
onSelect: function( selectedDate ) {
var option1 = this.id == "hotel_display_checkin_date" ? "minDate" : "maxDate",
instance = $( this ).data( "datepicker" ),
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings ),
options = {option1: date}
dates.not( this ).datepicker( "option", options );
}
});
I tried adding the altField parameter to the parameters = {option1: date}, but this does not work
source
share