A CLI Tool for timezones made using golang ⚡
- Search for date and time based on country, or timezones.
- Manage list for timezones you frequently view.
- Get UTC date and time based on your local timezone or any timezones.
- Convert time across timezones
- Special thanks to @MitaliBhalla for the idea & feedback on the project.
- Also thanks to @supreeth7 for providing code review & feedback on the project
You will need to Go >= 1.18
installed on your computer
First clone the repository somewhere in your $PATH. A common place would be within your $GOPATH.
Build and copy tmz
to your $GOPATH/bin:
$ make install
This command will build the Timezone CLI binary, named tmz
. This binary will be created in the root of your project folder.
$ make build
To list all commands:
$ tmz help
To run command with the full name:
$ tmz <command> [flags] <string>
Search can be done via country code or country name or city name that is included in the timezone list
tmz search <search-term>
$ tmz search "us"
$ tmz search "kol"
To search for a timezone based on abbreviation its abbreviations e.g IST
tmz get <abbreviation> [time]
$ tmz get "ist"
$ tmz get "est"
To get the converted time at the zone provide the local time as one of the arguments
$ tmz get "jst" 10:56
Timezones added to the config file are treated as the default timezones which is triggered by the tmz show --all
command.
If the timezone already exists, the CLI throws an error.
config file is stored at ~/.tmz.list
tmz add <timezone>
$ tmz add "Asia/Kolkata"
Timezones are removed from the config file
tmz remove <timezone>
$ tmz remove "Asia/Kolkata"
- This comand will help you to convert between timezones.
- The first timezone passed as argument is set as the default timezone. Other time are calculated based on it.
tmz show <timezone1> [timezone2, timezone3 ...] [--all] [--time time]
Flags:
--all Load all Timezones from local config
-t, --time string Show the list at a different time
- The
--time
flag will accept an time which will be used to show the list based on that time - The
--all
flag will load all the timezones saved on the config file
$ tmz show --all
$ tmz show "Asia/Jakarta" -t=10:56
To get a list of all local timezones that are saved in the config file.
tmz select
On selection it will provide an option to show the current time or convert the time based on provided local time
Get UTC time based on current system time.
tmz utc
Get an Interactive UI to see time across timezones.
tmz visual [timezone1, timezone2, ...] [--all]
Flags:
--all Load all Timezones from locally saved timezones
$ tmz visual --all
$ tmz visual "Asia/Kolkata" "Europe/Berlin"
- Redefined search
- Time Format Configuration
- Work with Daylight Savings
The project is open for feedback & contribution from all talented people across the globe. Feel free to reach out to me for any suggestions or improvemnts.
If there is an issue do open up a PR for the same