Skip to content

Ash1421/TZ-Convert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TZ-Convert

A precise IANA timezone resolver and converter — desktop GUI, REST API, web server, and a static site that runs fully offline.

License: GPL v3.0 Python

GitHub Issues New Issue

Live web version — tzc.ash1421.com


✨ What's Included

🌍 Timezone Resolver — Maps cities, states, countries, and abbreviations to correct IANA strings, with regional edge-case handling (e.g. western Kansas → Mountain Time, Florida panhandle → Central Time)
Time Converter — DST-aware conversion between any two IANA timezones
🖥️ Desktop GUI — Dark purple customtkinter app with live world clocks
🌐 Static Web Page — Works offline by cloning the repo and opening index.html; also live at tzc.ash1421.com
🔌 Flask REST API — Serve the app and API locally with --server
💻 CLI — Resolve or convert directly from your terminal


❤️ Made With Love Using

Python Flask customtkinter PyInstaller GitHub Actions GitHub Pages Shields.io


🌐 Web Version

The static site lives in the root of this repo (index.html + assets/). It is automatically deployed to tzc.ash1421.com on every push to main.

It works fully offline too — clone the repo and open index.html directly in your browser. No server or build step needed.


🚀 Installation

Option A — Run from source (Python 3.9+)

# 1. Clone the repo
git clone https://github.com/Ash1421/TZ-Convert.git
cd TZ-Convert

# 2. Install dependencies
# tzdata is required on Windows — it provides the timezone database
pip install -r requirements.txt

# 3. Launch (GUI by default)
python src/main.py

💻 Usage

Desktop GUI

python src/main.py
python src/main.py --gui

Three tabs: Converter, Resolver, and World Clocks. World Clocks updates live every second.


Web Server

python src/main.py --server
# Open http://127.0.0.1:5000

# Custom host and port:
python src/main.py --server --host 0.0.0.0 --port 8080

Serves the same static frontend as the GitHub Pages site, plus the REST API at /api/.


CLI

# Resolve a location to its IANA timezone
python src/main.py --cli Denver
python src/main.py --cli "Goodland, KS"
python src/main.py --cli PST
python src/main.py --cli Australia
python src/main.py --cli "New Zealand"

# Convert a time between zones
python src/main.py --cli "2026-06-22 14:30" UTC "Australia/Sydney"
python src/main.py --cli "2026-06-22 09:00" "America/Denver" "Asia/Tokyo"

REST API Reference

All endpoints return JSON. Default base: http://127.0.0.1:5000

GET /api/convert — Convert a time

Parameter Required Description
time yes YYYY-MM-DD HH:MM
from yes Source IANA timezone (or alias / location)
to yes Target IANA timezone (or alias / location)
/api/convert?time=2026-06-22+14:30&from=UTC&to=Australia/Sydney

GET /api/resolve — Resolve a location

/api/resolve?location=Denver
/api/resolve?location=Goodland%2C+KS
/api/resolve?location=Australia

GET /api/current — Current time in a timezone

/api/current?tz=America/Denver

GET /api/timezones — Search IANA strings

/api/timezones?q=australia
/api/timezones?prefix=America

GET /api/world — World clock snapshot


Resolution Logic

The resolver works through 10 priority steps:

  1. Timezone alias — PSTAmerica/Los_Angeles
  2. Direct IANA string — America/Denver passed through validated
  3. City lookup — DenverAmerica/Denver
  4. City + region — Goodland, KSAmerica/Denver (western Kansas override)
  5. US state — KansasAmerica/Chicago
  6. Country — AustraliaAustralia/Sydney
  7. Fuzzy city match
  8. Fuzzy state match
  9. Fuzzy country match
  10. System timezone fallback

Multi-timezone state overrides:

State Default Override
Kansas America/Chicago Western counties (Goodland, Liberal, Garden City…) → America/Denver
Florida America/New_York Panhandle (Pensacola, Destin…) → America/Chicago
Texas America/Chicago Far west (El Paso, Marfa…) → America/Denver

Building the EXE

Requires Windows (or the Windows runner in CI).

pip install pyinstaller tzdata
pip install -r requirements.txt
pyinstaller tz_convert.spec --noconfirm
# Output: dist/tz-convert.exe

🐛 Issues & Support


📜 License

This project is licensed under the GPL V3.0 (GNU General Public License V3.0).


Made with 💜 by @Ash1421

Star this repo if it helped!

About

Precise IANA timezone resolution and conversion — desktop GUI, Flask API, and an offline-capable static site.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Contributors