function render(){ let l=document.getElementById('list'); if(!Array.isArray(matchesList)) matchesList=[]; let f=[...matchesList]; function getStatus(m){ let s = m.status; if(!s) return 'NS'; if(typeof s === 'string') return s; if(typeof s === 'object') return s.short || s.type || s.name || 'NS'; return String(s); } if(curF=="LIVE") f=f.filter(m=>{let s=getStatus(m).toUpperCase(); return s.includes('LIVE')||['1H','2H','HT','ET','LIVE'].includes(s);}); if(curF=="FINISHED") f=f.filter(m=>{let s=getStatus(m).toUpperCase(); return s.includes('FIN')||['FT','AET','PEN','FINISHED'].includes(s);}); if(curF=="UPCOMING") f=f.filter(m=>{let s=getStatus(m).toUpperCase(); return s==''||['NS','TBD','PST','CANC','SCHEDULED','NOT STARTED'].includes(s);}); if(!f.length){l.innerHTML='
No '+curF+' matches for '+curDate+'
';return;} let h=''; f.forEach(m=>{ let home=m.home?.name||'Home'; let away=m.away?.name||'Away'; let hs=m.score?.home??m.home?.score??'-'; let as=m.score?.away??m.away?.score??'-'; let stRaw=getStatus(m); let st=stRaw; let lg=m.league?.name||'League'; let liveClass=st.toUpperCase().includes('LIVE')||['1H','2H','HT'].includes(st.toUpperCase())?'live':''; let timeStr=''; try{let d=m.date; if(d){timeStr=new Date(d).toLocaleTimeString('en-NG',{hour:'2-digit',minute:'2-digit',timeZone:'Africa/Lagos'})+' • ';}}catch(e){} h+='
'+lg+'
'+home+'
'+away+'
'+timeStr+st+'
'+hs+'
-
'+as+'
'; }); l.innerHTML=h; }