{"id":13710430,"url":"https://github.com/clickingbuttons/datetime","last_synced_at":"2025-05-06T19:30:59.543Z","repository":{"id":236419971,"uuid":"792575593","full_name":"clickingbuttons/datetime","owner":"clickingbuttons","description":"Generic Date, Time, and DateTime library.","archived":false,"fork":false,"pushed_at":"2025-04-30T20:06:05.000Z","size":42,"stargazers_count":14,"open_issues_count":0,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-30T20:44:47.990Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Zig","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/clickingbuttons.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}},"created_at":"2024-04-27T01:05:06.000Z","updated_at":"2025-04-30T20:05:29.000Z","dependencies_parsed_at":"2024-11-13T20:34:18.319Z","dependency_job_id":"0612a479-defe-42bf-bc6b-e9f363ac0562","html_url":"https://github.com/clickingbuttons/datetime","commit_stats":null,"previous_names":["clickingbuttons/datetime"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clickingbuttons%2Fdatetime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clickingbuttons%2Fdatetime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clickingbuttons%2Fdatetime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clickingbuttons%2Fdatetime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clickingbuttons","download_url":"https://codeload.github.com/clickingbuttons/datetime/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252753228,"owners_count":21798937,"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","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":[],"created_at":"2024-08-02T23:00:56.042Z","updated_at":"2025-05-06T19:30:59.524Z","avatar_url":"https://github.com/clickingbuttons.png","language":"Zig","readme":"# datetime\n\n![zig-version](https://img.shields.io/badge/dynamic/yaml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fclickingbuttons%2Fdatetime%2Fmaster%2F.github%2Fworkflows%2Ftest.yml\u0026query=%24.jobs.test.steps%5B1%5D.with.version\u0026label=zig-version)\n![tests](https://github.com/clickingbuttons/datetime/actions/workflows/test.yml/badge.svg)\n[![docs](https://github.com/clickingbuttons/datetime/actions/workflows/publish_docs.yml/badge.svg)](https://clickingbuttons.github.io/datetime)\n\nGeneric Date, Time, and DateTime library.\n\n## Installation\n```sh\nzig fetch --save \"https://github.com/clickingbuttons/datetime/archive/refs/tags/0.14.0.tar.gz\"\n```\n\n`build.zig`\n```zig\nconst datetime = b.dependency(\"datetime\", .{\n    .target = target,\n    .optimize = optimize,\n});\nyour_lib_or_exe.root_module.addImport(\"datetime\", datetime.module(\"datetime\"));\n```\n\nRun `zig build` and then copy the expected hash into `build.zig.zon`.\n\n## Usage\n\nCheck out [the demos](./demos.zig). Here's a simple one:\n```zig\nconst std = @import(\"std\");\nconst datetime = @import(\"datetime\");\n\ntest \"now\" {\n    const date = datetime.Date.now();\n    std.debug.print(\"today's date is {rfc3339}\\n\", .{ date });\n\n    const time = datetime.Time.now();\n    std.debug.print(\"today's time is {rfc3339}\\n\", .{ time });\n\n    const nanotime = datetime.time.Nano.now();\n    std.debug.print(\"today's nanotime is {rfc3339}\\n\", .{ nanotime });\n\n    const dt = datetime.DateTime.now();\n    std.debug.print(\"today's date and time is {rfc3339}\\n\", .{ dt });\n\n    const NanoDateTime = datetime.datetime.Advanced(datetime.Date, datetime.time.Nano, false);\n    const ndt = NanoDateTime.now();\n    std.debug.print(\"today's date and nanotime is {rfc3339}\\n\", .{ ndt });\n}\n```\n\nFeatures:\n- Convert to/from epoch subseconds using world's fastest known algorithm. [^1]\n- Choose your precision:\n    - Date's `Year` type.\n    - Time's `Subsecond` type.\n    - Date's `epoch` for subsecond conversion.\n    - Whether DateTime has an `OffsetSeconds` field\n- Durations with addition.\n- RFC3339 parsing and formatting.\n    - Timezone offset.\n\nIn-scope, PRs welcome:\n- [ ] Localization\n- [ ] Leap seconds\n\n## Why yet another date time library?\n- I frequently use different precisions for years, subseconds, and UTC offsets.\n- Systems use different epochs and Zig aims to be a sytems language.\n\n[^1]: [Euclidean Affine Functions by Cassio and Neri.](https://arxiv.org/pdf/2102.06959)\n","funding_links":[],"categories":["Language Essentials"],"sub_categories":["Date, Time and Timezones"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclickingbuttons%2Fdatetime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclickingbuttons%2Fdatetime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclickingbuttons%2Fdatetime/lists"}