{"id":30896759,"url":"https://github.com/sleeyax/world-time-api","last_synced_at":"2025-09-08T23:45:06.355Z","repository":{"id":312802317,"uuid":"1029793985","full_name":"sleeyax/world-time-api","owner":"sleeyax","description":"Returns the current local time for a given timezone or IP (worldwide)","archived":false,"fork":false,"pushed_at":"2025-09-02T03:39:16.000Z","size":370,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-02T05:35:25.815Z","etag":null,"topics":["geolocation","ip-geolocation","time","time-api","timezone","world-time-api"],"latest_commit_sha":null,"homepage":"https://timeapi.world","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sleeyax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-31T15:26:18.000Z","updated_at":"2025-08-13T20:51:53.000Z","dependencies_parsed_at":"2025-09-02T05:35:28.908Z","dependency_job_id":"d4a9c2bb-eb5c-419a-b712-79606e9f8db9","html_url":"https://github.com/sleeyax/world-time-api","commit_stats":null,"previous_names":["sleeyax/world-time-api"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/sleeyax/world-time-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sleeyax%2Fworld-time-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sleeyax%2Fworld-time-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sleeyax%2Fworld-time-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sleeyax%2Fworld-time-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sleeyax","download_url":"https://codeload.github.com/sleeyax/world-time-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sleeyax%2Fworld-time-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274231139,"owners_count":25245675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geolocation","ip-geolocation","time","time-api","timezone","world-time-api"],"created_at":"2025-09-08T23:45:05.548Z","updated_at":"2025-09-08T23:45:06.347Z","avatar_url":"https://github.com/sleeyax.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# World Time API\n\n[![Tests](https://github.com/sleeyax/world-time-api/actions/workflows/test.yml/badge.svg)](https://github.com/sleeyax/world-time-api/actions/workflows/test.yml)\n\nFast, reliable and up to date alternative to [worldtimeapi.org](http://worldtimeapi.org/). It returns the current local time details for a given timezone or IP address in JSON (or plain text) format.\n\n## Feature Comparison\n\nComparison of APIs that provide similar functionality.\n\n| Feature                                           | This project     | worldtimeapi.org | ipgeolocation.io |\n| ------------------------------------------------- | ---------------- | ---------------- | ---------------- |\n| 📅 Frequently updated                             | ✅               | ❌               | ❓               |\n| 🟢 Reliable                                       | ✅               | ❌ \\*            | ✅               |\n| 🚀 Performance                                    | Fast             | Slow             | Average          |\n| 🕒 Timezone support                               | ✅               | ✅               | ✅               |\n| 🌍 Geo IP support                                 | ✅               | ✅               | ✅               |\n| 👐 Open source                                    | ✅               | ❌               | ❌               |\n| 💼 Commercial use                                 | ✅               | ❌               | ✅               |\n| 🔄 Backwards compatible with worldtimeapi.org API | ✅               | n/a              | ❌               |\n| 📝 Response formats                               | JSON, plain text | JSON, plain text | JSON             |\n\n\\* has been down multiple times in the past, and still suffers from occasional 'connection reset' errors.\n\n## Roadmap\n\nA couple of features that are planned for the future:\n\n- [ ] Provide additional geolocation data API endpoints (coordinates, country, city, etc.). We have the data, just not the API endpoints.\n- [ ] IPV6 support. Our database already supports this, we just need to import the relevant dataset and update the API documentation accordingly.\n- [Suggest a feature!](https://github.com/sleeyax/world-time-api/issues?q=sort%3Aupdated-desc+is%3Aissue+is%3Aopen)\n\n## Data Sources\n\nWe use the following open data sources to provide accurate timezone information:\n\n- Timezone data from [IANA timezone database](https://www.iana.org/time-zones)\n- Geo IP data from [maxmind geolite2](https://dev.maxmind.com/geoip/geolite2-free-geolocation-data/)\n\nBoth are standards in the industry and are updated regularly to reflect changes in timezones and IP geolocation data.\n\n## API Endpoints\n\nThe API follows the World Time API specification with the following endpoints:\n\n### Timezone Endpoints\n\n- `GET /api/timezone` - List all available timezones (JSON)\n- `GET /api/timezone.txt` - List all available timezones (plain text)\n- `GET /api/timezone/{area}` - List timezones for specific area (JSON)\n- `GET /api/timezone/{area}.txt` - List timezones for specific area (plain text)\n- `GET /api/timezone/{area}/{location}` - Get current time for location (JSON)\n- `GET /api/timezone/{area}/{location}.txt` - Get current time for location (plain text)\n- `GET /api/timezone/{area}/{location}/{region}` - Get current time for region (JSON)\n- `GET /api/timezone/{area}/{location}/{region}.txt` - Get current time for region (plain text)\n\n### IP-based Endpoints\n\n- `GET /api/ip` - Get time based on client IP (JSON)\n- `GET /api/ip.txt` - Get time based on client IP (plain text)\n- `GET /api/ip/{ipv4}` - Get time based on specific IP (JSON)\n- `GET /api/ip/{ipv4}.txt` - Get time based on specific IP (plain text)\n\n## Response Formats\n\n### DateTime\n\nJSON:\n\n```json\n{\n  \"utc_offset\": \"-04:00\",\n  \"timezone\": \"America/New_York\",\n  \"day_of_week\": 6,\n  \"day_of_year\": 214,\n  \"datetime\": \"2025-08-02T13:02:11.703-04:00\",\n  \"utc_datetime\": \"2025-08-02T17:02:11.703+00:00\",\n  \"unixtime\": 1754154131,\n  \"raw_offset\": -18000,\n  \"week_number\": 31,\n  \"dst\": true,\n  \"abbreviation\": \"EDT\",\n  \"dst_offset\": 3600,\n  \"dst_from\": \"2025-03-09T07:00:00+00:00\",\n  \"dst_until\": \"2025-11-02T06:00:00+00:00\",\n  \"client_ip\": \"127.0.0.1\"\n}\n```\n\nPlain Text:\n\n```\nutc_offset: -04:00\ntimezone: America/New_York\nday_of_week: 6\nday_of_year: 214\ndatetime: 2025-08-02T13:02:51.390-04:00\nutc_datetime: 2025-08-02T17:02:51.390+00:00\nunixtime: 1754154171\nraw_offset: -18000\nweek_number: 31\ndst: true\nabbreviation: EDT\ndst_offset: 3600\ndst_from: 2025-03-09T07:00:00+00:00\ndst_until: 2025-11-02T06:00:00+00:00\nclient_ip: 127.0.0.1\n```\n\n## Development\n\n### Installation\n\n```bash\n# Modify your .env file accordingly\ncp .env.example .env\n\n# Install dependencies\nnpm install\n\n# Start development server\nnpm run dev\n```\n\nTo create a local database with the latest geo IP data, run:\n\n```bash\n# Initialize the database schema\nnpx wrangler d1 execute geolite2 --local --file=./schema.sql\n\n# Note the output path:\nnpm run download:geo -- --chunk-size 500 --max-rows 10000 --dump-only --add-transaction --optimize-writes\n\n# Import the dumped .SQL file to your local database\nnpx wrangler d1 import geolite2 --local --file=./.tmp/1754073802022.sql\n# OR (CHANGE THE EXAMPLE PATH TO YOUR ACTUAL PATH):\nsqlite3 .wrangler/state/v3/d1/miniflare-D1DatabaseObject/6548e7f3bc532c7cd454dcbd6dd89f52914826489289e023ef76de4fb5bd7843.sqlite \u003c .tmp/1754073802022.sql\n```\n\nFor testing purposes, you can also specify a flag to only dump a couple of statements:\n\n```bash\n# Only dump 100 rows 10 times\nnpm run download:geo -- --dump-only --chunk-size 100 --chunk-count 10\n```\n\n## Production\n\nEverything is hosted on [Cloudflare](https://www.cloudflare.com/) using:\n\n- [cloudflare workers](https://developers.cloudflare.com/workers/) (serverless platform)\n- [cloudflare D1](https://developers.cloudflare.com/d1/) (database)\n\nTo manually import data into the database, you can use the following commands:\n\n```bash\n# Initialize the database schema if you haven't done so already\nnpx wrangler d1 execute geolite2 --remote --file=./schema.sql\n\n# Download the latest geo IP data and import it into the database using the cloudflare API,\n# in chunks of 250,000 rows (+- 39 MB per file)\nnpm run download:geo -- --chunk-size 250000 --split-files\n```\n\n## License\n\nThis project is licensed under the BSL 1.1 license, with a change date of `one year from release date` after which the license automatically changes to GPL v3. See [LICENSE](./LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsleeyax%2Fworld-time-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsleeyax%2Fworld-time-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsleeyax%2Fworld-time-api/lists"}