Git Product home page Git Product logo

tz's Introduction

๐ŸŒ A time zone helper

tz helps you schedule things across time zones. It's an interactive TUI program that displays time across the time zones of your choosing.

Usage

Run tz with no arguments to show the local time, as well as the UTC time zone. It gets more useful when you pass some time zones to the program, to list those below the local time zone.

For now, you need to select the time zones from the tz_data list. Yes, there are plans to make this friendlier for humans too. You're welcome to file an issue about it. I enjoy reading those.

If you would rather not type the list everytime, you could set an alias for your shell, or use the TZ_LIST environment variable with a semi-colon separated list of tz data zone names (see Configuration below). Command-line arguments trump the environment variable.

Check out tz -h for other flags.

The program will adjust to light and dark terminals themes.

Installing

I provide linux/amd64 builds for "official" releases, and you can build from source for your favorite architecture. Kind souls have also packaged the program for other OSes.

Packages

Brew

Brew has a tz package: brew install tz

Archlinux

If you're an Archlinux user, packages are also available:

  • tz follows releases and,
  • tz-git builds the main git branch.

Go

go install github.com/oz/tz@latest

Configuration

The tz program uses standard time zones as described here. You should specify what time zones to display by setting the TZ_LIST environment variable. The local time is always displayed first. To display your local time, the time in California, and the time Paris, you have to set TZ_LIST to US/Pacific;Europe/Paris

Zone Alias

The TZ_LIST env. variable recognizes items from the standard tz database names, but you can alias these, using a special value: use the standard name followed by , and your alias. For example:

TZ_LIST="Europe/Paris,EMEA office;US/Central,US office"

Building

You need a recent-ish release of go with modules support:

git clone https://github.com/oz/tz
cd tz
go build

Testing

go test -cover

Contributing

Please do file bugs, and feature requests. I am accepting patches too, those are the best, but please, open an issue first to discuss your changes. ๐Ÿ˜„

License

The GPL3 license.

Copyright (c) 2021-2022 Arnaud Berthomier

tz's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tz's Issues

cmd line accept timezone abbreviations

It is tedious and error prone to enter full names. For most people using timezones regulalry we will remember the most used zone abbreviations e.g. AEDT instead of australia/sydney or CST instead of america/los_angeles

Cannot display more than 2 timezones

On arch, I am able to provide up to two timezones, any further timezone is ignored.

โฏ TZ_LIST="Europe/Berlin;America/Santiago" tz

  What time is it?

  ๐Ÿ•› (CEST) Local 12:07PM, Sat 15
   0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22

  ๐Ÿ•• (-04) America/Santiago 6:07AM, Sat 15
  18  19  20  21  22  23   0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16


 
โฏ TZ_LIST="Europe/Berlin;Asia/Bangkok;America/Santiago" tz

  What time is it?

  ๐Ÿ•› (CEST) Local 12:08PM, Sat 15
   0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22

  ๐Ÿ•› (CEST) Europe/Berlin 12:08PM, Sat 15
   0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22

Basic user configuration

The current "configuration story" simply loads a list of timezones from the environment variable TZ_LIST: this is just fine for me. The same could be said of the colors: they're just fine for my dark terminal... but probably not for everyone.

If I get enough complaints, maybe I'll consider making the colors a configuratble option, loaded from the user's config. directory. Then the TZ_LIST env var could either disappear or enhance a file configuration variable. ๐Ÿค”

Show the date on day change

At midnight, we should have an indication of the current date for each zone, as it is often changing right at this time.

-q doesn't work

1st off, great tool. Love it!

Now, I installed this tool via Homebrew on my MBP running macOS 10.14.6 Mojave. It works great except for the -q not working. I see that -q was only added to the repos main branch 15 hours ago so maybe it didn't make it into the release used on Homebrew. Just checked and Homebrew is currently using v0.4 and checking the v0.4 tag I see flag package using in main is not present. OK, no prob. Just a note for others who are confused then. Will the -q option be present in v0.5 then?

Adding and deleting time zones

The UI must allow one to add arbitrary time zones from the tz db.

  • key bindings to navigate between the configured time zones (arrows, j, k, ...),
  • delete, or backspace, or d should show a confirmation dialog to remove the zone,
  • + to show the "add a time zone" dialog where the UI helps auto-complete from the tzdb list.

Notes:

Since go 1.15, there is a time/tzdata package that one can embed to work around cases where the info is not available on the host (this adds 800kb to the binary ๐Ÿ˜).

Display name for selected TZ

enhancement

This may or may not be worthwhile for you. I tend to think of the people I'm working with in terms of the city/country that they work in. Since the standard TZ database is small by design, it doesn't really allow one to be specific. For instance, America/Tampa Bay isn't a thing, and so you would choose America/New York or America/Detroit to get to the Eastern Time zone. Off the top of my head, something like:

TZ_LIST=America/Detroit;Tampa Bay,America/Chicago;Minneapolis

Would allow one to display Tampa Bay and Minneapolis for those two time zones.

Just a thought, I love the simplicity of the interface, and using TZ_LIST seems just fine, I didn't see, is there a way to get tz to list out the TZ names for a particular UTC offset?

Date difference is incorrect when moving between dates

Neat time tool! A hopefully helpful bug report: When launching tz, it will correctly note a date difference (or lack thereof) between different time zones, but when you use arrow keys to move to other times, it will still maintain the date difference established on launch for all other times, even when it should change. See video, which compares US/Central to US/Eastern time zones. Comparing with US/Pacific shows correctly that there is not currently a date difference, but then continues to claim there is never a date difference at any hour.

Screen.Recording.2023-03-20.at.11.20.14.PM.mov

List known timezones

The biggest problem I had with getting started with TZ was populating TZ_LIST. The screenshot showed entries like "-07" and "GMT" but the TZ_LIST only understands the full/city_name style. So it'd be helpful if tz had a flag to dump the list, so I could at least grep for relevant entries. Ideally there'd be a UI where I can search and add timezones that tz will remember (~/.config/tz) for next launch.

24 hour times

thanks for the tool. i would find it pleasant to have times displayed in 24-hour format, rather than "AM"/"PM".

Recognize top world cities

I love the program, but it cannot tell me time for example in Dallas, which would be very handy. It would take a map of large cities to timezones. I can contribute this part, if you take PRs.

Is 0.6.2 an actual release?

I noticed that a month ago a "v0.6.2" tag appeared in this repo: https://github.com/oz/tz/tags (which currently matches main -- e23d811)

... but 0.6.1 is still the most recent "release" https://github.com/oz/tz/releases

Is this intentional? Is that tag going to become a release later, or is last year's 0.6.1 still considered "current"?

I ask because right now homebrew is confused, because it's scanning the version-number-looking git tags in the repo:

$  brew livecheck --verbose tz
tz (guessed): 0.6.1 ==> 0.6.2

If 0.6.1 is really the correct "latest release" I can tweak the homebrew livecheck rules for that formula to only consider the github release page and ignore tags. But I don't want to do that if 0.6.2 is merely an accidentally-forgotten release

`brew` installer needed

Thanks for the great software! I think if you were to have a brew install, adoption of the product would be much higher.

Suggestion: Auto build binaries for different OS on release

I've recently discovered a nice Github workflow, that automagically creates binaries for (almost) all supported Go binary formats. Once a new Github release has been drafted, the action will build binaries (including a checksum file) for Linux, Windows, MacOS and *BSD and append it to the release page. This would help people without a go build environment to easily get hands on a tz-binary.

I've added the workflow to a project of mine, and it works like a charme. You can see an example here:
https://github.com/wneessen/apg.go/releases/tag/v0.2.9

The action can be found on Github Marketplace: https://github.com/marketplace/actions/go-release-binaries

Since Github workflows (to my knowledge) cannot be PR'ed, I link to the workflow files I am currently using, which have been proven to work w/o issues:
*BSD: https://github.com/wneessen/apg.go/blob/main/.github/workflows/release-bsd.yml
MacOS: https://github.com/wneessen/apg.go/blob/main/.github/workflows/release-darwin.yml
Linux: https://github.com/wneessen/apg.go/blob/main/.github/workflows/release-linux.yml
Windows: https://github.com/wneessen/apg.go/blob/main/.github/workflows/release-windows.yml

More Options?

Since -q is coming to a future release near you can we also add -v and/or -version/--version so we can check what version is installed without having to dig into the package manager, please? I'd ask for -h and -help/--help but you get that for free with the flag package. ๐Ÿ‘ผ

Sliding time window

I want to be able to use this for choosing appropriate hours of the day between cities.

The site I use most for this is timeanddate.com

E.g.
https://www.timeanddate.com/worldclock/meetingtime.html?iso=20221023&p1=446&p2=4

In some cases for the current day, there isn't sufficient overlap in working hours to schedule a meeting time, so I want to advance to the next 24 hours of overlap.

When moving the cursor to the right, it currently just winds back around to the beginning of the current 24 hour window, I propose that it now advances and redraws or advances the window forward in time.

Match names to timezones?

When working with several timezones on a daily basis, it can be confusing to remember which timezone corresponds to which person (or persons, in my case) you want to find a suitable time to meet with. It'd be great if we could include names which match timezones. Would be really handy if this would be configurable.

Quit immediately if stdout is not a terminal

This isn't really an intended use case, but I was curious about what would happen when I ran tz | less. It breaks, unsurprisingly. ๐Ÿ˜†

tz captures the keyboard, but less is still confused by that. So I can't quit less with 'q'. I think tz should behave as if -q was passed when stdout is not a terminal.

[feature] Display all timezones

When first coming to this repository I found

grafik

particulary appealing since I expected ยดtzยด without further arguments to display

A) a list of all timezones
B) timezones at night having a dark background / timezones currently in daytime having a light background

I think both would make for useful features. Could you think of implementing this?

When running ยดtzยด I will see my timezone compared to only UTC with a dark background currently.

Add option to exit immediately

I understand this app is interactive as in it lets you change the time and show/hide the date, but it would be nice to add an option (perhaps -q?) to just show the output and terminate.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.