From d321ecaac376af446ef8a474ef7cd45d77fd6ce3 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sat, 24 Apr 2021 14:32:50 -0400 Subject: [PATCH] Fix --- types/timezone.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/types/timezone.js b/types/timezone.js index 82b7299c..d8add864 100644 --- a/types/timezone.js +++ b/types/timezone.js @@ -13,8 +13,8 @@ module.exports = class TimezoneType extends ArgumentType { const directZone = moment.tz.zone(value); if (directZone) return true; try { - const zipZone = new ZipToTz().full(value); - return zipZone; + new ZipToTz().full(value); + return true; } catch { const cityZone = cityTimezones.lookupViaCity(value); if (cityZone.length) return true; @@ -28,10 +28,15 @@ module.exports = class TimezoneType extends ArgumentType { value = value.replaceAll(' ', '_').toLowerCase(); const directZone = moment.tz.zone(value); if (directZone) return directZone.name; - const cityZone = cityTimezones.lookupViaCity(value); - if (cityZone.length) return cityZone[0].timezone; - const provZone = cityTimezones.findFromCityStateProvince(value); - if (provZone.length) return provZone[0].timezone; + try { + const zipZone = new ZipToTz().full(value); + return zipZone; + } catch { + const cityZone = cityTimezones.lookupViaCity(value); + if (cityZone.length) return cityZone[0].timezone; + const provZone = cityTimezones.findFromCityStateProvince(value); + if (provZone.length) return provZone[0].timezone; + } return null; } };