Jorge Turbica / blog · Blog ← All articles ES · Leer en español
Languages

Jiff 1.0, the Rust datetime crate behind uv and Cargo, vows never to break its API

BurntSushi's datetime library hits 1.0 with 285M downloads: Zoned becomes ZonedDateTime, and there's a commitment to never ship a 2.0 lightly.

Jiff has passed 285 million downloads on crates.io, and uv, Cargo, Starship, fd, Nushell, mise and Jujutsu run it in production. On November 15, 2026 its author, Andrew Gallant (BurntSushi, of ripgrep fame), shipped 1.0 with a promise you rarely see in Rust: there will be no 2.0 unless a serious API defect turns up.

What 1.0 commits to

This major version matters more for what it locks in than for what it adds. Jiff wants to be an ecosystem building block, the kind of crate that shows up in other libraries' public APIs. That only works if its types don't change every few months: if your crate exposes a jiff::Timestamp and Jiff ships a breaking release, every one of your users has a problem. With 1.0, Gallant commits to 1.x indefinitely and explicitly encourages putting Jiff types in public APIs.

The design borrows from Temporal, JavaScript's standard date API: zone-less civil types (civil::Date, civil::DateTime), Timestamp for absolute instants, and ZonedDateTime for an instant in a specific IANA zone. The practical difference from other libraries is that time zones sit at the center of the API instead of being bolted on.

What breaks when upgrading from 0.2

The big change is simple and touches almost everything: Zoned is now ZonedDateTime, and the methods that mention it follow (Timestamp::to_zoned is now Timestamp::to_zoned_datetime). The rest, per the CHANGELOG, is minor:

  • Subtracting two Timestamp values returns a SignedDuration.
  • Converting a Timestamp to SystemTime can fail and returns a Result.
  • Offset::saturating_add is fallible too.
  • The ToSpan trait is sealed, so you can't implement it for your own types.
  • jiff_tzdb::VERSION is now required.
  • The minimum supported Rust version moves to 1.85.

Why it's worth it: DST gaps

The example that best explains Jiff is a time that never happened. On March 8, 2026, clocks in New York jumped from 2:00 to 3:00. If a user schedules something for 2:30 that day, Jiff doesn't quietly pick one: it makes you choose a strategy.

rust
use jiff::{civil::date, tz::{offset, TimeZone}};

fn main() -> anyhow::Result<()> {
    let tz = TimeZone::get("America/New_York")?;
    // 2:30 did not exist on March 8, 2026: clocks jumped from 2:00 to 3:00
    let dt = date(2026, 3, 8).at(2, 30, 0, 0);

    let zdt = tz.to_ambiguous_zoned_datetime(dt).compatible()?;
    assert_eq!(zdt.offset(), offset(-4));

    // Or refuse to guess
    assert!(tz.to_ambiguous_zoned_datetime(dt).unambiguous().is_err());
    Ok(())
}

compatible() matches Temporal (in a gap, it picks the later time), earlier() and later() force a side, and unambiguous() returns an error. For an SRE, this is the bug that shows up once a year, at 3 a.m., in a cron job or a billing calculation.

Jiff vs chrono

chrono is Rust's most widely used date library. Jiff's own comparison document (written against chrono 0.4.38) boils down to this:

Jiff 1.0chrono
Time zone databaseThe system's (/usr/share/zoneinfo); on Windows it embeds one via jiff-tzdbThrough the separate chrono-tz crate
Serializing with a zoneLossless round trip: 2024-03-10T01:59:59-05:00[America/New_York]Stores only the offset: after deserializing, the zone and DST-aware math are gone
Zone-aware calendar mathAdding a day respects DST, and differences in days stay consistent with that additionAdds days zone-aware (through a separate API), but can't compute day differences consistent with it
PerformanceCompetitive overall, always faster at parsing and printingFaster in some operations
Stability1.0 with an indefinite commitment0.4.x

The real question isn't whether to rip chrono out of code that works, but what to use for new code that deals with time zones. There, Jiff is now the safer bet: it has the API that's hardest to misuse and, since November 15, the most stable one. If you only measure elapsed time, Gallant himself points out that std::time::Instant is enough, and if you live entirely in UTC with Unix timestamps, the standard library will do.

How to upgrade

bash
# New project, or upgrading from 0.2
cargo add jiff@1
cargo build

Checklist before you ship:

  1. Make sure your toolchain is Rust 1.85 or newer.
  2. Replace Zoned with ZonedDateTime and to_zoned with to_zoned_datetime; the compiler will point at every use.
  3. Review Timestamp subtraction and SystemTime conversions, which now return a different type or a Result.
  4. If you depend on several libraries that expose Jiff types, wait until all of them support 1.0: mixing 0.2 and 1.0 in the dependency tree gives you types that don't line up.
  5. Test with dates around your zones' DST transitions, which is where the library earns its keep.

Sources

Jorge Turbica

Software Engineer and SRE. I write about the real challenges I run into in production.

See portfolio ↗