This commit is contained in:
Dragon Fire
2021-04-24 14:32:50 -04:00
parent 33e9249144
commit d321ecaac3
+11 -6
View File
@@ -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;
}
};