Have a small if/else problem in javascript. i don't see the logic...
The function should check if two dates are present and give alerts if it's not present. If everything is OK, it should say so...
function update_booking() {
    //from_date = The date of arrival
    //to_date = The date of departure
    var alert = ""; //reset alerts
    //get variables from booking form input
    var from_date = new Date(document.getElementById('from').value);
    var to_date = new Date(document.getElementById('to').value);
    //if arrival and departure date is present
    if(from_date && to_date) {
        var alert = "Everything is OK";
    }
    //if one or two dates are missing
    else {
        //if arrival and departure dates are missing
        if(from_date == 'undefined' || to_date == 'undefined'){
            var alert = "Arrival date and departure date are missing";  
        }
        //if from_date is missing update with value from to_date
        if(from_date == 'undefined') {
            var alert = "Arrival date are missing";
        }
        //if to_date is missing update with value from from_date
        if(from_date == 'undefined') {
            var alert = "Departure date are missing";
        }
    } //end else if one or more date(s) missing
    //write alerts
    document.getElementById('alert').innerHTML = alert;
}
 
     
     
     
     
    