Coder Social home page Coder Social logo

ibledy / timezone-converter Goto Github PK

View Code? Open in Web Editor NEW
13.0 3.0 6.0 554 KB

Whole-day timezone comparison

License: MIT License

Python 94.25% Dockerfile 5.75%
timezone timezone-converter rich pytz python list comparison datetime date-formatting time-formatting

timezone-converter's Introduction

Timezone Converter

Compare a full day of your local timezone with foreign ones


integration status deployment status pre-commit.ci status python version latest release code style

$ timezone-converter tijuana --zone $ timezone-converter tijuana new_york
comparison between two timezones with zone info comparison between three timezones

Motivation

When working with people that are not in your local timezone, the available resources are the usual webpages that only show one hour at a time, which is pretty inconvenient.

With this package you can quickly compare a full day of your timezone against foreign ones.

Installation

pip install -U timezone-converter

Usage

timezone-converter <timezone> [<timezone> ...]

Docker

docker run --rm -t bledy/timezone-converter <timezone> [<timezone> ...]

Features

Comparison between multiple timezones

Multiple timezones can be provided to get a side-by-side comparison.

Current hour highlighting

The row containing the current hour will be highlighted.

Output a single hour

Using the --single argument, you can output a single hour. If you don't provide a value, the current hour will be displayed.

List of available timezones

Using the --list argument, you can see a pretty list of available timezones, by groups, and sorted alphabetically.

$ timezone-converter --list

list of available timezones

License

This project is licensed under the terms of the MIT license.

timezone-converter's People

Contributors

badboy-16 avatar drzcola avatar faithkovi avatar ibledy avatar pre-commit-ci[bot] avatar steffenschroeder avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

timezone-converter's Issues

Wrong timezone for GMT+-X conversion

Issue:

The timezone output of the gmt+x and gmt-x seems to be swapped.
For the reference, Hong Kong is in GMT+8.

Step to reproduce:

$ timezone-converter --version
timezone-converter 0.12.1

$ timezone-converter hong_kong gmt-5 gmt+5

┏━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
┃      LOCAL       ┃  ASIA/HONG_KONG  ┃    ETC/GMT-5     ┃    ETC/GMT+5     ┃
┡━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
│ 2022-11-24 00:00 │ 2022-11-24 00:00 │ 2022-11-23 21:00 │ 2022-11-23 11:00 │
│ 2022-11-24 01:00 │ 2022-11-24 01:00 │ 2022-11-23 22:00 │ 2022-11-23 12:00 │
│ 2022-11-24 02:00 │ 2022-11-24 02:00 │ 2022-11-23 23:00 │ 2022-11-23 13:00 │
│ 2022-11-24 03:00 │ 2022-11-24 03:00 │ 2022-11-24 00:00 │ 2022-11-23 14:00 │
│ 2022-11-24 04:00 │ 2022-11-24 04:00 │ 2022-11-24 01:00 │ 2022-11-23 15:00 │
...

Sort output by least difference

When the user inputs multiple timezones, we could sort the output so after the local timezone there's always the one that has the least difference.

  • We should try to preserve the user order, so if there's no difference we use the input order.

  • We may also add an argument to preserve the user order even if the sorted output would be different. Maybe we can use--preserve-order or --no-sort? Or maybe even have this feature as an opt-in via --order

For example, in the following screenshot, new_york has less difference than tijuana, so the sorted output would be:

  1. local
  2. new_york
  3. tijuana

screenshot

Show difference in hours

We can show what the hour difference is, maybe where we show the --zone.

  • It can be just a number, but I think we should use gmt+
  • We can use an argument like --difference

Add a search option to the cli

This would add a --search option to the cli, which can be used to search timezones by name.

Examples:

$ timezone-converter --search "new york"
Found 1 timezone: "new_york"
$ timezone-converter --search mad
Found 2 timezones: "madeira", "madrid"

Better argument name to output a single hour

I think we should change the argument to something like --hour. Initially we used -s/--single to avoid collision with -h (help) argument. Hour seems more appropiate, but suggestions are welcome.

The initial work was discussed in #3, and done in #16.

Suggestion: shorter programme name in command line

It's such a pleasure to use and work on this amazing project and thanks @ibLeDy for your work. 🎉

Just a suggested change from my experience of working on this project.

I sometimes find the programme name (timezone-converter) too long to type in the command line when testing my PR or running the programme. It would be nice to use a shorter name like tz-conv or tz-convert (can be anything). The current repo name can still remain unchanged.

For example, timezone-converter --list can possibly be tz-conv --list

Change deployment action so it is only when we manually create a release

Right now, when we push a new tag, a release is automatically created with the artifacts attached, and the new release is also automatically uploaded to pypi.

This has some possible disadvantages:

  • We need to be careful when and where to push the tags.
  • As the release is automatically created, we would need to edit the release after the fact.
  • A release is always published to pypi, and if a problem arises, we have to manually fix things later.

If we change this, we would be more conscious about the releases, and we could manually triple-check that everything is correct, then publish to pypi.

Also note that before commit ce5df97, we were checking for new tags only on the master branch.

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.