From 8181f4f586ff32e416f644fe308d137649782d7e Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 24 Aug 2026 02:44:43 +0000 Subject: [PATCH] Make Dallas searchable in the timezone selector Dallas has no IANA zone of its own (it uses America/Chicago), so searching "Dallas" previously returned no results. Denver already worked since America/Denver is a real IANA zone. Add a small city alias map so Dallas resolves to America/Chicago, with the match labeled in the dropdown so it's clear why it appeared. --- index.html | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 8d3ca05..4e7188a 100644 --- a/index.html +++ b/index.html @@ -901,6 +901,12 @@

})(); const DETECTED_TZ = Intl.DateTimeFormat().resolvedOptions().timeZone; + // Cities with no IANA zone of their own (e.g. Dallas uses America/Chicago) + // but that people search by city name. + const CITY_ALIASES = { + 'america/chicago': ['dallas'], + }; + function tzOffsetLabel(tz) { try { const fmt = new Intl.DateTimeFormat('en-US', { timeZone: tz, timeZoneName: 'shortOffset' }); @@ -1187,12 +1193,19 @@

list.innerHTML = ''; const q = (filter || '').toLowerCase(); const filtered = q - ? ALL_TIMEZONES.filter(tz => tz.toLowerCase().includes(q) || tzOffsetLabel(tz).toLowerCase().includes(q)) + ? ALL_TIMEZONES.filter(tz => { + const key = tz.toLowerCase(); + return key.includes(q) || tzOffsetLabel(tz).toLowerCase().includes(q) || + (CITY_ALIASES[key] || []).some(alias => alias.includes(q)); + }) : ALL_TIMEZONES; filtered.slice(0, 50).forEach(tz => { const li = document.createElement('li'); li.className = 'tz-option' + (tz === selectedTz ? ' active' : ''); - li.textContent = tzFriendlyName(tz); + const matchedAlias = q && (CITY_ALIASES[tz.toLowerCase()] || []).find(alias => alias.includes(q)); + li.textContent = matchedAlias + ? `${tzFriendlyName(tz)} — ${matchedAlias.replace(/\b\w/g, c => c.toUpperCase())}` + : tzFriendlyName(tz); li.addEventListener('click', (e) => { e.stopPropagation(); selectedTz = tz;