Jiff 1.0: A datetime library for Rust burntsushi.net · 130 points · 35 comments ...
HN Best 200 @best
Jiff 1.0: A datetime library for Rust burntsushi.net · 130 points · 35 comments · HN thread
TL;DR Jiff 1.0, a Rust datetime library by BurntSushi, is announced with a long tour of its API. Its design puts time zones at the center so that daylight saving time edge cases (folds, gaps) are handled by default, and it borrows heavily from JavaScript's Temporal. The author commits to keeping the 1.0 API stable indefinitely, since Jiff is meant to appear in other libraries' public APIs.
- Jiff 1.0 is declared stable; the author commits to the API indefinitely unless a significant defect is found, because it is intended as an ecosystem building block.
- Jiff is already used in uv, Cargo, Starship, fd, Nushell, mise, Jujutsu, uutils/coreutils, and as the basis for a Temporal implementation in AWS LLRT.
- The core types are a layered 'onion': civil Date/Time/DateTime (no location), Timestamp (instant), TimeZone, and ZonedDateTime; ambiguous local times in folds and gaps are resolved by selectable strategies (compatible, earlier, later, reject).
- Span preserves calendar and physical units separately (2 hours vs 120 minutes are distinct values), while SignedDuration covers only physical time.
- Jiff adds a lossless 'friendly' duration format (e.g. '6y 10mo 3d 23h') because ISO 8601 durations cannot represent every Span value, such as 2000 milliseconds.
- Jiff supports only the Gregorian calendar and a datetime range of about ±9999 years; other calendars and locale-aware formatting are delegated to ICU4X via integration crates.
Discussion The thread is warm and mostly appreciative, with many commenters praising BurntSushi's work and the library's documentation. Much of the discussion centers on Rust's decision to keep datetime out of the standard library, with a long exchange on the trade-offs of a small std plus a strong package ecosystem versus a built-in default. Chrono's deprecation status comes up repeatedly and pushes people toward Jiff. A few side threads cover time-scale needs for scientific use, and a playful thread about the 'gif' pronunciation joke.
- Jiff is a strong, well-documented replacement for chrono (many): Several commenters say they switched or plan to switch, citing ease of migration and quality of the docs. One notes chrono is being deprecated, which accelerates the move.
- Rust should have datetime in its standard library (some): Some argue a built-in default would reduce supply chain risk and keep ecosystem integration simple. Others note that official status does not require inclusion in std.
- A small std with good package management is the better model (some): A commenter argues that keeping std small lets APIs evolve in third-party crates, avoiding forced breaking changes; the time/chrono/jiff history is cited as evidence.
- Chrono is still preferred and Jiff is not necessary (a few): One commenter says chrono is comparatively nice and they would rather keep using it, though they acknowledge the deprecation news.
- Jiff's scope limits make it unsuitable for scientific time scales (a few): An astrodynamics user says Jiff only supports Unix time, so they need hifitime, which they found too noisy for long-term simulations.
- Praise for the project's honesty about when not to use it (a few): A commenter appreciates the 'When should I use Jiff?' section and the calm acknowledgment of limits.
Links from the comments