Please convert this function to js:

function get_quiz_graph($conn){                                                                                                    
// $qda=get_quiz_time_delay($conn);                                                                                                
  $sdt=''; $days='';                                                                                                               
  if(isset($_REQUEST['df'])){                                                                                                      
    $dt=isset($_REQUEST['dt'])?strtotime($_REQUEST['dt']):time();                                                                  
    $days=floor(($dt-strtotime($_REQUEST['df']))/86400);                                                                           
    $s=$days>1?'s':'';                                                                                                             
    if($days>-1) $sdt=" ($_REQUEST[df])";                                                                                          
    if($days>1) $sdt=" (since $_REQUEST[df]: $days day$s)"; // start time                                                          
    }                                                                                                                              
 $rv='';                                                                                                                           
 $cls=$_SESSION['cdd']>0?$_SESSION['cdd']:$_SESSION['class'];                                                                      
 $wh=isset($_REQUEST['u'])?"AND id=$_REQUEST[u]":'';                                                                               
 $sql="SELECT id, full_name, gender, dob, stt FROM tbl_users WHERE row_status=0 $wh AND user_class IN($cls) AND user_role=7 ORDER BY full_name";                                                                                                                      
// echo "$sql<br>";                                                                                                                
 $result=$conn->query($sql);                                                                                                       
 if($result->num_rows>0) {                                                                                                         
  $rv.="<div id=pid>Quiz Results$sdt</div>";                                                                                       
  $rv.="<table>";                                                                                                                  
  $rv.='<thead>';                                                                                                                  
  $rv.="<tr><th>#</th><th>Name</th><th title='Age'>A</th><th title='Gender'>G</th><th title='No of Quiz Sessions'>QS</th><th title='No of Quiz Questions'>QC</th><th title='No of Words'>W</th><th title='Quizzes Average '>QA</th><th>Graph</th></tr>";              
  $rv.='</thead>';                                                                                                                 
  $rv.='<tbody>';                                                                                                                  
  $j=0;                                                                                                                            
  while($row=$result->fetch_assoc()){                                                                                              
   $stt=strtotime($row['stt']); // start time                                                                                      
   $nds=floor((time()-$stt)/86400);                                                                                                
   $g=$row['gender']==1?'M':'F';                                                                                                   
   $a=date_diff(date_create($row['dob']), date_create('now'))->y;                                                                  
//   $ga=get_daily_quiz($row['id'],$conn);                                                                                         
   $ga=get_quiz_by_user_det($row['id'],$conn);       
  $a1="<a href=index.php?r=10&&u=$row[id]>";                                                                                      
   $a2="<a href=index.php?r=10&qw=1&u=$row[id]>";                                                                                  
   $a0='</a>';                                                                                                                     
   $sp=str_repeat('&nbsp;',$ga[0]*2.5);                                                                                            
   $w=$ga[0]*21; $px='px';                                                                                                         
//   $wd=" style='width:$w$px'";                                                                                                   
   if($ga[1]>0){                                                                                                                   
    $j++;                                                                                                                          
//    $rv.="<tr><td>$j</td><td class=np>$a1$row[full_name]$a0</td><td class=no>$a</td><td>$g</td><td class=no>$ga[0]</td><td class=no>$a2$qwc$a0</td><td class=no>$qa[0]</td><td class=no>$qa[1]</td><td>$sp$ga[4]</td></tr>";                                        
    $rv.="<tr><td>$j</td><td class=np>$a1$row[full_name]$a0</td><td class=no>$a</td><td>$g</td><td class=no>$ga[0]</td><td class=no>$ga[1]</td><td class=no>$a2$ga[2]$a0</td><td class=no>$ga[3]</td><td>$sp$ga[4]</td></tr>";                                        
    }                                                                                                                              
   }                                                                                                                               
  $rv.='</tbody>';                                                                                                                 
  $rv.="</table>";                                                                                                                 
//  $rv.="<br>";                                                                                                                   
 }                                                                                                                                 
 return $rv;                                                                                                                       
}