I have two textboxes, one is arrival and another is departed. If the user tries to input for example.:
"2017-03-09" in departure and the arrival date has "2017-03-10", I want the departure value to be the same as arrival.
My code does not work at the moment for some reason.
jQuery:
function onChange(sender, txt, departed) {
var txtArrival = $("#txtArrivalDate");
var txtArrivalDate = $(txtArrival).val(); //Value from arrival
var txtDate = $(txt).val(); //Value from departed
var departureDate = new Date(txtDate); //Converting string to date
var arrivalDate = new Date(txtArrivalDate); //Converting string to date
if (departureDate.getTime() < arrivalDate.getTime()) {
txt.val = txtArrivalDate; //Does not work, value is not updated
}
}