BurntSushi/jiff
Developer ToolsA Rust datetime library for time-zone-aware arithmetic, parsing and formatting, built to make common mistakes hard.
Overview
Jiff is a Rust datetime library that aims to make correct time handling the easy path: high-level primitives that are hard to misuse, combined with what the author calls reasonable performance. It covers IANA time zones via the Time Zone Database, DST-aware arithmetic and rounding, lossless formatting and parsing of zone-aware datetimes, and optional Serde support. Its API is heavily inspired by the TC39 Temporal proposal for JavaScript README.
The library is a good fit for Rust applications that need to represent instants, civil dates, durations and zoned datetimes across time zones, especially where DST transitions or serialization correctness matter. A design rationale document and a comparison against chrono, time, hifitime and icu are included for readers choosing between crates design rationale, comparison.
Quick start
Install Rust and add the dependency to an existing crate:
cargo add jiff
Parse an RFC 3339 instant, convert it to a named time zone, add a span, and print it losslessly:
use jiff::{Timestamp, ToSpan};
fn main() -> Result<(), jiff::Error> {
let time: Timestamp = "2024-07-11T01:14:00Z".parse()?;
let zoned = time.in_tz("America/New_York")?.checked_add(1.month().hours(2))?;
assert_eq!(zoned.to_string(), "2024-08-10T23:14:00-04:00[America/New_York]");
assert_eq!(zoned.timestamp().to_string(), "2024-08-11T03:14:00Z");
Ok(())
}
For a fresh project, the README walks through cargo new, cargo add jiff, a small src/main.rs and cargo run; the program prints the current zoned time with its IANA identifier README. More examples live in the API documentation.
Constraints
- Minimum supported
rustcis 1.85.0; MSRV increases are limited to minor releases and are not treated as semver breakage README. - On Unix, time zone transitions come from the system IANA database (usually
/usr/share/zoneinfo, configurable viaTZDIR), and the system zone is read from/etc/localtime. On Windows, a time zone database is embedded and the Windows zone identifier is mapped to IANA via CLDR data README, platform notes. - Crate features control
stdsupport, Serde, and embedding the time zone database; the full list is in the crate features documentation. - Performance is deliberately secondary to API clarity and correctness; some paths have been optimized, others not, and benchmarks live in
benchREADME. - Licensed under MIT or the Unlicense README.
HotRepo's take
In the July 2024 Hacker News thread (448 points, 241 comments), commenters focused less on raw speed than on API design and the depth of the time zone handling. One reader pointed to the design document as evidence that datetime libraries are harder than "just store Unix time," and cited DST-aware arithmetic, roundable durations and Serde round-tripping as the substantive part comment; another summarized the motivation as API and IANA time zone support comment. The fluent ToSpan syntax drew criticism for mixing a leading integer with method arguments, with alternatives suggested comment, comment. A later Rust daily ranking snapshot (2026-11-17) records Jiff at first place with 61 stars gained that day, so the project continues to attract attention well after the initial release discussion.
Written by AI from the project's README, updated . The project's own docs are the source of truth.
Hacker News
You might also like
- abseil/abseil-cppA C++17 library collection that extends the standard library with containers, strings, logging, synchronization and other production-tested utilities.
- rust-lang/rustThe Rust compiler, standard library, and documentation source, for developers building or contributing to Rust.
- makepad/relaxA live Rust compiler and JIT runtime that runs Cargo packages from source and hot-patches edits into the running process.
- NVIDIA/cuda-rustWrite and run CUDA GPU kernels in Rust using either tensor-style Tile kernels or low-level SIMT control.
- bendlang/bendA dependently typed language with a fast proof checker, aimed at making AI-generated code verifiable by machine.