function tzn() { const tz = event.target.selectedOptions[0].dataset.tz; if (tz) sib(event.target,'input').value = tz; } function tzt() { sib(event.target,'select').value = ''; } fetchconfig('tzlist') .then(map => { function cln(z) { return ('tz/'+z).replaceAll('/','_ ') .replaceAll(/[^\w ]+/g,'-'); } var elem = getelem('tzname'); var grp = elem; map.set('',''); map.set('UTC','UTC0'); var zones = Array.from(map.keys()); zones = zones.filter(v => v && v != 'UTC').sort(); zones.unshift('','UTC'); for (const z of zones) { const zz = z.match(/^(?:(\S+?)\/)?(\S*)$/,z); if (!zz) { continue; } if (zz[1] && zz[1] != grp.label) { grp = document.createElement('OPTGROUP'); grp.label = zz[1]; grp.className = cln(zz[1]); elem.append(grp); } else if (!zz[1]) { grp = elem; } const pz = zz[2].replaceAll('_',' ').replaceAll('/',': '); var opt = new Option(pz, z); opt.className = cln(z); opt.dataset.tz = map.get(z); grp.append(opt); } translate(elem); }) .finally(() => {loadform('setconfig','sys/getconfig');} );