Validating a date in a grid
This isn't "optimized", I just tried to make it more readable.
As I cant test it (really wish people would make jsbin examples to test with, buggered if Im going to do it) I have no idea if it works ;)  

function onAccrualEndDateChange(current) {
  var endDate = $(current).val();

  if (endDate === "") {
    $(current).closest("td").removeClass("cell-error");
    return;
  }
  if (endDate === null) {
    $(current).closest("td").addClass("cell-error");
    return;
  }

  var actualEndDate = {
    month: endDate.getMonth(),
    date: endDate.getDate(),
    fullYear: endDate.getFullYear()
  };

  var tempEndDate = parseInt(actualEndDate.month + 1, 10) + "/" + actualEndDate.date + "/" + actualEndDate.fullYear;

  if (!ValidateDate(tempEndDate)) {
    $(current).closest("td").addClass("cell-error");
    return;
  }

  var startDate = $(current).closest("tr").find("input[id$='StartDate']").val();

  if (startDate === "") {
    $(current).closest("tr").find("input[id$='StartDate']").closest("td").addClass("cell-error");
    return;
  }
  if (startDate === null) {
    $(current).closest("td").addClass("cell-error");
    return;
  }

  var actualStartDate = {
    month: startDate.getMonth(),
    date: startDate.getDate(),
    fullYear: startDate.getFullYear()
  };

  var tempStartDate = parseInt(actualStartDate.month + 1, 10) + "/" + actualStartDate.date + "/" + actualStartDate.fullYear;

  if (!ValidateDate(tempStartDate)) {
    $(current).closest("td").addClass("cell-error");
    return;
  }

  if (actualStartDate.date &gt; actualEndDate.date || actualStartDate.month &gt; actualEndDate.month || actualStartDate.fullYear &gt; actualEndDate.fullYear) {
    $(current).closest("td").addClass("cell-error");
  } else {
    $(current).closest("td").removeClass("cell-error");
  }
}