Skip to content

Commit

Permalink
show time zones with offset
Browse files Browse the repository at this point in the history
  • Loading branch information
ueffel committed Apr 25, 2021
1 parent 5ba143c commit 7074982
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions time.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,12 @@ def on_suggest(self, user_input, items_chain):
elif ((len(items_chain) % 2 == 1) and items_chain[0].target() == "timezone") \
or (len(items_chain) > 1 and len(items_chain) % 2 == 0 and items_chain[0].target() == "time"):
suggestions = []
for timezone in dateutil.zoneinfo.get_zonefile_instance().zones:
for name, timezone in dateutil.zoneinfo.get_zonefile_instance().zones.items():
suggestions.append(self.create_item(
category=kp.ItemCategory.KEYWORD,
label=timezone.replace("_", " "),
short_desc="Time in timezone '{}'".format(timezone),
target=timezone,
label="{} ({})".format(name.replace("_", " "), datetime.datetime.utcnow().astimezone(tz=timezone).strftime('%z')),
short_desc="Time in timezone '{}'".format(name),
target=name,
args_hint=kp.ItemArgsHint.REQUIRED,
hit_hint=kp.ItemHitHint.IGNORE,
loop_on_suggest=True
Expand Down

0 comments on commit 7074982

Please sign in to comment.