Date () is a constructor function, when you call it, you assign the result of this constructor to a variable. Then in the line after that, you assign another object, the result of the jQuery val () method, to the same variable.
endDate = $("input[id$='DateTimeControl2Date']").val()
Date() , . /:
var endDate = new Date($("input[id$='DateTimeControl2Date']").val());
, , Date(). statusDate.
</" > , Date(). IE, , mm/dd/yyyy. , Date():
var endDateSplit = $("input[id$='DateTimeControl2Date']").val().split("/"),
endDate = new Date(endDateSplit[2], endDateSplit[1]-1, endDateSplit[0]);