ho fatto cosi ma mi dà errore

codice:
function controllo1(uno, due) {
  temp1 = uno.split("-");
  temp2 = due.split("-");

  d1 = new Date(temp1[0], temp1[1]-1, temp1[2]);
  d2 = new Date(temp2[0], temp2[1]-1, temp2[2]);
  
  g1 = d1.getDay()
  g2 = d2.getDay() 
  
  h1 = h1.getDay()
  
  if (h1 > d1) {
  alert ("ATTANZIONE DATA ERRATA");
  document.frm.data1.focus();
  document.frm.data1.select();
  return false; 

  }
  
  if (h1 > d2) {
  alert ("ATTANZIONE DATA ERRATA");
  document.frm.data2.focus();
  document.frm.data2.select();
  return false; 

  }