{"id":13477523,"url":"https://github.com/BurntSushi/jiff","last_synced_at":"2025-03-27T05:32:01.317Z","repository":{"id":249583596,"uuid":"759017108","full_name":"BurntSushi/jiff","owner":"BurntSushi","description":"A datetime library for Rust that encourages you to jump into the pit of success.","archived":false,"fork":false,"pushed_at":"2025-03-23T00:42:56.000Z","size":2886,"stargazers_count":2104,"open_issues_count":14,"forks_count":50,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-25T18:56:05.170Z","etag":null,"topics":["calendar","civil","date","date-time","datetime","duration","iana","iso8601","jiff","local","rfc2822","rust","strftime","strptime","temporal","time","timezone","tzdb","utc","zone"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BurntSushi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"COPYING","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},"funding":{"github":["BurntSushi"]}},"created_at":"2024-02-17T18:31:06.000Z","updated_at":"2025-03-24T14:49:29.000Z","dependencies_parsed_at":"2024-07-30T03:29:44.086Z","dependency_job_id":"e1106e8f-0187-40f8-bb42-ec1bbeb24e0a","html_url":"https://github.com/BurntSushi/jiff","commit_stats":{"total_commits":127,"total_committers":9,"mean_commits":14.11111111111111,"dds":0.09448818897637801,"last_synced_commit":"d3e0a16495df21ba86b908f6152932178753e5f0"},"previous_names":["burntsushi/jiff"],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BurntSushi%2Fjiff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BurntSushi%2Fjiff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BurntSushi%2Fjiff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BurntSushi%2Fjiff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BurntSushi","download_url":"https://codeload.github.com/BurntSushi/jiff/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245562956,"owners_count":20635907,"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":["calendar","civil","date","date-time","datetime","duration","iana","iso8601","jiff","local","rfc2822","rust","strftime","strptime","temporal","time","timezone","tzdb","utc","zone"],"created_at":"2024-07-31T16:01:44.017Z","updated_at":"2025-03-27T05:32:01.310Z","avatar_url":"https://github.com/BurntSushi.png","language":"Rust","readme":"Jiff\n====\nJiff is a datetime library for Rust that encourages you to jump into the\npit of success. The focus of this library is providing high level datetime\nprimitives that are difficult to misuse and have reasonable performance. Jiff\nsupports automatic and seamless integration with the Time Zone Database, DST\naware arithmetic and rounding, formatting and parsing zone aware datetimes\nlosslessly, opt-in Serde support and a whole lot more.\n\nJiff takes enormous inspiration from [Temporal], which is a [TC39] proposal to\nimprove datetime handling in JavaScript.\n\n[![Build status](https://github.com/BurntSushi/jiff/workflows/ci/badge.svg)](https://github.com/BurntSushi/jiff/actions)\n[![Crates.io](https://img.shields.io/crates/v/jiff.svg)](https://crates.io/crates/jiff)\n[![Docs.rs](https://img.shields.io/docsrs/jiff)](https://docs.rs/jiff)\n\nDual-licensed under MIT or the [UNLICENSE](https://unlicense.org/).\n\n[TC39]: https://tc39.es/\n[Temporal]: https://tc39.es/proposal-temporal/docs/index.html\n\n### Documentation\n\n* [API documentation on docs.rs](https://docs.rs/jiff)\n* [Comparison with `chrono`, `time`, `hifitime` and `icu`](COMPARE.md)\n* [The API design rationale for Jiff](DESIGN.md)\n* [Platform support](PLATFORM.md)\n* [CHANGELOG](CHANGELOG.md)\n\n### Example\n\nHere is a quick example that shows how to parse a typical RFC 3339 instant,\nconvert it to a zone aware datetime, add a span of time and losslessly print\nit:\n\n```rust\nuse jiff::{Timestamp, ToSpan};\n\nfn main() -\u003e Result\u003c(), jiff::Error\u003e {\n    let time: Timestamp = \"2024-07-11T01:14:00Z\".parse()?;\n    let zoned = time.in_tz(\"America/New_York\")?.checked_add(1.month().hours(2))?;\n    assert_eq!(zoned.to_string(), \"2024-08-10T23:14:00-04:00[America/New_York]\");\n    // Or, if you want an RFC3339 formatted string:\n    assert_eq!(zoned.timestamp().to_string(), \"2024-08-11T03:14:00Z\");\n    Ok(())\n}\n```\n\nThere are many more examples in the [documentation](https://docs.rs/jiff).\n\n### Usage\n\nJiff is [on crates.io](https://crates.io/crates/jiff) and can be\nused by adding `jiff` to your dependencies in your project's `Cargo.toml`.\nOr more simply, just run `cargo add jiff`.\n\nHere is a complete example that creates a new Rust project, adds a dependency\non `jiff`, creates the source code for a simple datetime program and then runs\nit.\n\nFirst, create the project in a new directory:\n\n```text\n$ cargo new jiff-example\n$ cd jiff-example\n```\n\nSecond, add a dependency on `jiff`:\n\n```text\n$ cargo add jiff\n```\n\nThird, edit `src/main.rs`. Delete what's there and replace it with this:\n\n```rust\nuse jiff::{Unit, Zoned};\n\nfn main() -\u003e Result\u003c(), jiff::Error\u003e {\n    let now = Zoned::now().round(Unit::Second)?;\n    println!(\"{now}\");\n    Ok(())\n}\n```\n\nFourth, run it with `cargo run`:\n\n```text\n$ cargo run\n   Compiling jiff v0.2.0 (/home/andrew/rust/jiff)\n   Compiling jiff-play v0.2.0 (/home/andrew/tmp/scratch/rust/jiff-play)\n    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.37s\n     Running `target/debug/jiff-play`\n2024-07-10T19:54:20-04:00[America/New_York]\n```\n\nThe first time you run the program will show more output like above. But\nsubsequent runs shouldn't have to re-compile the dependencies.\n\n### Crate features\n\nJiff has several crate features for customizing support for Rust's standard\nlibrary, `serde` support and whether to embed a copy of the Time Zone Database\ninto your binary.\n\nThe \"[crate features](https://docs.rs/jiff/#crate-features)\" section of the\ndocumentation lists the full set of supported features.\n\n### Future plans\n\nWith `jiff 0.2` out about 6 months after the `jiff 0.1` initial release, my\nplan remains roughly the same as it started. That is, I'd still like to get a\n`jiff 1.0` release out this summer 2025 (in about 6 months) and then commit to\nit indefinitely. This plan may change if something critically wrong is found\nwith the current API.\n\nThe purpose of this plan is to get Jiff to a 1.0 stable state as quickly as\npossible. The reason is so that others feel comfortable relying on Jiff as\na public dependency that won't cause ecosystem churn.\n\n### Performance\n\nThe most important design goal of Jiff is to be a high level datetime library\nthat makes it hard to do the wrong thing. Second to that is performance. Jiff\nshould have reasonable performance, but there are likely areas in which it\ncould improve. See the `bench` directory for benchmarks.\n\nNote that performance is still an important goal. Some aspects of Jiff have\nhad optimization attention paid to them, but many still have not. It is a goal\nto improve where we can, but performance will generally come second to API\ncomprehension and correctness.\n\n### Platform support\n\nThe question of platform support in the context of datetime libraries comes up\nprimarily in relation to time zone support. Specifically:\n\n* How should Jiff determine the time zone transitions for an IANA time zone\nidentifier like `Antarctica/Troll`?\n* How should Jiff determine the default time zone for the current system?\n\nBoth of these require some level of platform interaction.\n\nFor discovering time zone transition data, Jiff relies on the\n[IANA Time Zone Database]. On Unix systems, this is usually found at\n`/usr/share/zoneinfo`, although it can be configured via the `TZDIR`\nenvironment variable (which Jiff respects). On Windows, Jiff will automatically\nembed a copy of the time zone database into the compiled library.\n\nFor discovering the system time zone, Jiff reads `/etc/localtime` on Unix. On\nWindows, Jiff reads the Windows-specific time zone identifier via\n[`GetDynamicTimeZoneInformation`] and then maps it to an IANA time zone\nidentifier via Unicode's [CLDR XML data].\n\nI expect Jiff to grow more support for other platforms over time. Please file\nissues, although I will likely be reliant on contributor pull requests for more\nobscure platforms that aren't easy for me to test.\n\nFor more on platform support, see [`PLATFORM.md`](PLATFORM.md).\n\n[IANA Time Zone Database]: https://en.wikipedia.org/wiki/Tz_database\n[`GetDynamicTimeZoneInformation`]: https://learn.microsoft.com/en-us/windows/win32/api/timezoneapi/nf-timezoneapi-getdynamictimezoneinformation\n[CLDR XML data]: https://github.com/unicode-org/cldr/raw/main/common/supplemental/windowsZones.xml\n\n### Dependencies\n\nAt time of writing, it is no accident that Jiff has zero dependencies on Unix.\nIn general, my philosophy on adding new dependencies in an ecosystem crate like\nJiff is very conservative. I consider there to be two primary use cases for\nadding new dependencies:\n\n1. When a dependency is _practically_ required in order to interact with a\nplatform. For example, `windows-sys` for discovering the system time zone on\nWindows.\n2. When a dependency is necessary for inter-operability. For example, `serde`.\nBut even here, I expect to be conservative, where I'm generally only willing\nto depend on things that have fewer breaking change releases than Jiff.\n\nA secondary use case for new dependencies is if Jiff gets split into multiple\ncrates. I did a similar thing for the `regex` crate for very compelling\nreasons. It is possible that will happen with Jiff as well, although there are\nno plans for that. And in general, I expect the number of crates to stay small,\nif only to make keep maintenance lightweight. (Managing lots of semver API\nboundaries has a lot of overhead in my experience.)\n\n### Minimum Rust version policy\n\nThis crate's minimum supported `rustc` version is `1.70.0`.\n\nThe policy is that the minimum Rust version required to use this crate can be\nincreased in minor version updates. For example, if jiff 1.0 requires Rust\n1.20.0, then jiff 1.0.z for all values of `z` will also require Rust 1.20.0 or\nnewer. However, jiff 1.y for `y \u003e 0` may require a newer minimum version of\nRust.\n","funding_links":["https://github.com/sponsors/BurntSushi"],"categories":["Rust","Libraries","Recently Updated","\u003ca name=\"Rust\"\u003e\u003c/a\u003eRust"],"sub_categories":["Date and time","[Dec 11, 2024](/content/2024/12/11/README.md)"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBurntSushi%2Fjiff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBurntSushi%2Fjiff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBurntSushi%2Fjiff/lists"}