Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp tz command #95

Open
tk3369 opened this issue Jul 10, 2021 · 0 comments
Open

Revamp tz command #95

tk3369 opened this issue Jul 10, 2021 · 0 comments

Comments

@tk3369
Copy link
Member

tk3369 commented Jul 10, 2021

The current tz command is somewhat basic. Some of the shortcomings are:

  • It can only convert to a set of standard time zones (aliases)
  • Time zone aliases can only be changed via PRs
  • It cannot convert to a specific time zone that is not in the standard list.

I would like to revamp the interface as follows:

Examples

Update user preference

Use the “me” sub-command to register user preference. The data is stored and remembered so the user just needs to set it up once.

> tz me
Hey @tk3369, type `tz me [timezone]` to set up your local time zone. 
You can find a list of time zones at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

> tz me America/Los_Angeles
Hey @tk3369, your local time zone has been updated to America/Los_Angeles.

> tz me America/wat
Hey @tk3369, sorry, time zone "America/wat" is not valid. 
You can find a list of time zones at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

Set up system-wide aliases

Use “alias” sub-command to list, add, or remove time zone aliases. List results are sorted by alias names.

> tz alias list 
Hey @tk3369, the time zone aliases are:
- BRU: Europe/Brussels
- LA: America/Los_Angeles

> tz alias set NY America/New_York
Hey @tk3369, a new time zone alias "NY" has been set to "America/New_York"

> tz alias rm NY 
Hey @tk3369, time zone alias "NY" has been removed.

> tz alias rm BMW
Hey @tk3369, sorry, time zone alias "BMW" does not exist.

> tz alias set modtz America/Los_Angeles, America/New_York, Asia/Kolkata
Hey @tk3369, the new alias group `modtz` has been added with the following time zones:
- America/Los_Angeles
- America/New_York

> tz alias list
Hey @tk3369, time zone aliases are as follows:

- BRU: Europe/Brussels
- LA: America/Los_Angeles
- modtz: America/Los_Angeles, America/New_York, Asia/Kolkata

Convert to MY timezone

> tz convert 2021-03-21 03:00PM NY
Hey @tk3369, the local time for 2021-03-21 03:00PM NY is 2021-03-21 12:00PM America/Los_Angeles.

If I haven't configured my local timezone, then:

> tz convert 2021-03-21 03:00PM NY
Hey @tk3369, you have not configured your local time zone. Type `tz me` command to set that up.

Convert to OTHER timezones

Add a “to” function. Display results in standard time zones.

> tz convert 2021-03-21 03:00PM LA to NY
Hey @tk3369, 2021-03-21 03:00PM LA is same as 2021-03-21 06:00PM NY

> tz convert 2021-03-21 03:00PM LA to BMW
Hey @tk3369, sorry, time zone "BMW" does not exist.

> tz convert 2021-03-21 03:00PM LA to modtz
Hey @tk3369, 2021-03-21 03:00PM LA is the same as:
- 2021-03-21 03:00PM Americas/Los_Angeles (LA)
- 2021-03-21 06:00PM Americas/New_York (NY)
- 2021-03-21 03:30AM Asia/Kolkata (India)
This was referenced Jul 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant