As mentioned in comment, you should write
var selectedDate = $("#date").val();
if(selectedDate == "") { // use == instead of = here. It will check condition
alert("date is not selected");
}else{
alert(selectedDate);
}
Note:- single = is an assignment operator. It assigns the value to variable. While == checks the condition. You can also write if(selectedDate) to check date is selected or not.
solved Check if a date has been selected. Bootstrap input type date