(function(){ var root=document.getElementById('fg-concerts');if(!root)return; var today=new Intl.DateTimeFormat('sv-SE',{timeZone:'Europe/Rome',year:'numeric',month:'2-digit',day:'2-digit'}).format(new Date()); var shows=Array.from(root.querySelectorAll('article[data-start]')); var months=['January','February','March','April','May','June','July','August','September','October','November','December']; function render(container,list){ container.replaceChildren();var sections={}; list.forEach(function(show){var month=show.dataset.start.slice(0,7);if(!sections[month]){var section=document.createElement('section');section.className='month';var title=document.createElement('h2');title.textContent=months[Number(month.slice(5))-1]+' '+month.slice(0,4);section.appendChild(title);container.appendChild(section);sections[month]=section;}sections[month].appendChild(show);}); } var upcoming=shows.filter(function(s){return(s.dataset.end||s.dataset.start)>=today;}).sort(function(a,b){return a.dataset.start.localeCompare(b.dataset.start);}); var past=shows.filter(function(s){return(s.dataset.end||s.dataset.start)0;root.querySelector('details').hidden=past.length===0; })();