diff --git a/src/tww/tww.py b/src/tww/tww.py index 527a127..30ab393 100644 --- a/src/tww/tww.py +++ b/src/tww/tww.py @@ -79,6 +79,9 @@ def normalize_words_to_number(query): pytz_all_timezones = pytz.all_timezones NORMALIZED_TZ_DICT = dict(zip([tz.lower() for tz in pytz_all_timezones], pytz_all_timezones)) +TZ_OFFSETS = defaultdict(list) +TZ_OFFSETS_DST = defaultdict(list) +TZ_OFFSETS_NODST = defaultdict(list) NORMALIZED_TZ_ABBR = defaultdict(set) TZ_ABBRS_REVERSE = defaultdict(set) @@ -89,6 +92,10 @@ for x_tz in pytz_all_timezones: NORMALIZED_TZ_ABBR[nodst_tzname.lower()].add(x_tz) TZ_ABBRS_REVERSE[x_tz].add(dst_tzname) TZ_ABBRS_REVERSE[x_tz].add(nodst_tzname) + tz_offset = pytz.timezone(x_tz).localize(datetime.now()).strftime('%z') + TZ_OFFSETS[tz_offset].append(x_tz) + TZ_OFFSETS_DST[tz_offset].append(dst_tzname) + TZ_OFFSETS_NODST[tz_offset].append(nodst_tzname) def timezone_to_normal(query):