{"id":43310723,"url":"https://github.com/devries/timezone","last_synced_at":"2026-02-01T21:10:36.485Z","repository":{"id":315109318,"uuid":"1058154541","full_name":"devries/timezone","owner":"devries","description":"A library for working with time zones and the IANA tz database for gleam","archived":false,"fork":false,"pushed_at":"2025-11-01T15:09:27.000Z","size":59,"stargazers_count":2,"open_issues_count":2,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-20T10:08:05.475Z","etag":null,"topics":["gleam","gleam-language","time","timezone","timezones"],"latest_commit_sha":null,"homepage":"","language":"Gleam","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devries.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-09-16T17:37:58.000Z","updated_at":"2025-11-01T15:09:31.000Z","dependencies_parsed_at":"2025-09-16T20:21:36.112Z","dependency_job_id":null,"html_url":"https://github.com/devries/timezone","commit_stats":null,"previous_names":["devries/timezone"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/devries/timezone","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devries%2Ftimezone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devries%2Ftimezone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devries%2Ftimezone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devries%2Ftimezone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devries","download_url":"https://codeload.github.com/devries/timezone/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devries%2Ftimezone/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28991160,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T20:57:35.821Z","status":"ssl_error","status_checked_at":"2026-02-01T20:57:29.580Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["gleam","gleam-language","time","timezone","timezones"],"created_at":"2026-02-01T21:10:35.864Z","updated_at":"2026-02-01T21:10:36.475Z","avatar_url":"https://github.com/devries.png","language":"Gleam","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tzif\n\n[![Package Version](https://img.shields.io/hexpm/v/tzif)](https://hex.pm/packages/tzif)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/tzif/)\n\nTime zone support for Gleam time using the IANA Time Zone Database.\nThis package loads the time zone database from the standard location\n(`/usr/share/zoneinfo`) on MacOS and Linux computers. It includes a parser for\nthe Time Zone Information Format (TZif) or `tzfile` format, as well as utility\nfunctions to convert a timestamp from the\n[gleam_time](https://hexdocs.pm/gleam_time/) library into a date and time\nof day in the given time zone.\n\n\u003e We could really do with a timezone database package with a\n\u003e fn(Timestamp, Zone) -\u003e #(Date, TimeOfDay) function\n\u003e\n\u003e --- Louis Pilfold\n\nAdd to your project with the command:\n```\ngleam add tzif@1\n```\n\n# Using the Package\nThere are three modules in the `tzif` package:\n- `tzif/database` has utilities for loading the IANA Time Zone database.\n- `tzif/tzcalendar` has utilities for converting a [gleam_time](https://hexdocs.pm/gleam_time/)\n  timestamp into date and time of day in a time zone.\n- `tzif/parser` has functions and records for parsing TZif formatted data.\n\nThe most straightforward use would be to load the database from the default\nlocation on the operating system, and then obtain a timestamp using the\n[gleam_time](https://hexdocs.pm/gleam_time/) package, and convert that timestamp\ninto a time of day in a time zone using the IANA time zone name. An example\nof that is shown in the code below.\n\n```gleam\nimport gleam/int\nimport gleam/io\nimport gleam/string\nimport gleam/time/timestamp\nimport tzif/database\nimport tzif/tzcalendar\n\npub fn main() {\n    let now = timestamp.system_time()\n\n    // Load the database from the operating system\n    case database.load_from_os() {\n        Ok(db) -\u003e {\n            case tzcalendar.to_time_and_zone(now, \"America/New_York\", db) {\n                Ok(time_and_zone) -\u003e {\n                    // Successfully converted time to the requested time zone\n                    io.println(\n                        int.to_string(time_and_zone.time_of_day.hours)\n                        |\u003e string.pad_start(2, \"0\")\n                        \u003c\u003e \":\"\n                        \u003c\u003e int.to_string(time_and_zone.time_of_day.minutes)\n                        |\u003e string.pad_start(2, \"0\")\n                        \u003c\u003e \":\"\n                        \u003c\u003e int.to_string(time_and_zone.time_of_day.seconds)\n                        |\u003e string.pad_start(2, \"0\")\n                        \u003c\u003e \" \"\n                        \u003c\u003e time_and_zone.designation\n                    )\n                }\n                Error(database.ZoneNotFound) -\u003e io.println(\"Time zone not found\")\n                Error(database.ProcessingError) -\u003e\n                    io.println(\"Error processing time zone conversion\")\n            }\n        }\n        Error(Nil) -\u003e io.println(\"No parsable TZif files found.\")\n}\n```\nIf you are on windows and have installed the IANA Time Zone Database, or want\nto use a custom version you can use the `database.load_from_path` function\ninstead of the `database.load_from_os` function to specify a path to your\ndatabase files.\n\n# Installing the zoneinfo data files\nTime zone information is frequently updated, therefore it makes sense to use the\npackage manager for your operating system to keep the time zone database up to\ndate. All common unix variants have time zone database packages and install the\ntime zone database files into the `/usr/share/zoneinfo` directory by default.\n\n## MacOS\nThe files should be included in your operating system by default. Check the\n`/usr/share/zoneinfo` directory and see if they are present.\n\n## Ubuntu/Debian Linux Systems\nThe APT package manager can be used to install the compiled TZif files with the\nfollowing command:\n\n```\nsudo apt install tzdata\n```\n\n### Debian based docker containers\nInstalling and configuring the time zone database on a Debian or Ubuntu based\ndocker container can be done by adding the following to your `Dockerfile`:\n\n```\n# Use an ARG for the timezone, with a default of UTC\nARG TIMEZONE=Etc/UTC\n\n# Set the TZ environment variable and install tzdata\nRUN apt-get update \u0026\u0026 \\\n    export DEBIAN_FRONTEND=noninteractive \u0026\u0026 \\\n    ln -fs /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \u0026\u0026 \\\n    apt-get install -y tzdata \u0026\u0026 \\\n    dpkg-reconfigure --frontend noninteractive tzdata\n```\n\n## Alpine Linux Systems\nThe Alpine Package Keeper can install the time zone database using the command:\n\n```\nsudo apk add tzdata\n```\n\n### Alpine based docker containers\nInstalling and configuring the time zone database on an Alpine based docker\ncontainer can be done by adding the following to your `Dockerfile`:\n\n```\n# Use an ARG for the timezone, with a default of UTC\nARG TIMEZONE=Etc/UTC\n\n# 1. Install the tzdata package\n# 2. Copy the correct timezone file to /etc/localtime\n# 3. Set the TZ environment variable to be used by applications\nRUN apk add --no-cache tzdata \u0026\u0026 \\\n    cp /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \u0026\u0026 \\\n    echo \"${TIMEZONE}\" \u003e /etc/timezone\n```\n\n## Red Hat/Rocky/Alma Linux Systems\nYou can use the YUM package manager or DNF to install the time zone database\non Red Hat variants. To use YUM run the command:\n\n```\nsudo yum install tzdata\n```\n\nSimilarly, using DNF:\n\n```\nsudo dnf install tzdata\n```\n## Windows\nMicrosoft Windows has a different mechanism for handling time zones, however\nyou can install the IANA Time Zone Database by [downloading the latest\nversion](https://www.iana.org/time-zones) and compiling the zone files using\n[the directions in the repository](https://data.iana.org/time-zones/tz-link.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevries%2Ftimezone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevries%2Ftimezone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevries%2Ftimezone/lists"}