Skip to content

[rust] Move from chrono (deprecated) to jiff - #1567

Open
brandur wants to merge 1 commit into
masterfrom
rust-jiff
Open

brandur wants to merge 1 commit into
masterfrom
rust-jiff

Conversation

@brandur

@brandur brandur commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

It was called to my attention last week that it turns out that what's
been traditionally the main date/time library in Rust, chrono, is
actually soft deprecated [1]. The chrono maintainer recommends jiff [2]
as a replacement.

I figure that since River Rust is still quite new and River Pro for Rust
is still unreleased, it's the best time ever to make this jump. Although
annoying, jiff does seem to be very thoughtfully designed, with heavy
inspiration from Temporal in JavaScript.

[1] chronotope/chrono#1768
[2] https://crates.io/crates/jiff

It was called to my attention last week that it turns out that what's
been traditionally the main date/time library in Rust, chrono, is
actually soft deprecated [1]. The chrono maintainer recommends jiff [2]
as a replacement.

I figure that since River Rust is still quite new and River Pro for Rust
is still unreleased, it's the best time ever to make this jump. Although
annoying, jiff does seem to be very thoughtfully designed, with heavy
inspiration from Temporal in JavaScript.

[1] chronotope/chrono#1768
[2] https://crates.io/crates/jiff
@brandur

brandur commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

@bgentry This really sucks, but chrono's never going to get less deprecated, so the best time to switch is still probably now.

Jiff does seem a little better designed, and there was some nice simplification opportunities. For example, previously River had to do some pretty gnarly stuff to get specific RFC3339 formatting:

pub(crate) fn format_rfc3339_nano(timestamp: DateTime<Utc>) -> String {
    let mut formatted = timestamp.to_rfc3339_opts(SecondsFormat::Secs, true);
    let nanos = timestamp.nanosecond() % 1_000_000_000;
    if nanos > 0 {
        let fraction = format!("{nanos:09}");
        formatted.insert(formatted.len() - 1, '.');
        formatted.insert_str(formatted.len() - 1, fraction.trim_end_matches('0'));
    }
    formatted
}

Now it's just timestamp.to_string() because jiff's accepted that RFC3339 is the canonical format for timestamp strings.

Codex had some ideas about potentially putting in a date/time indirection layer to River, but that's definitely got some tradeoffs. I think the BurntSushi crates (which jiff is) have a pretty good maintenance track record, so it might be worth being a bit more optimistic about this one.

@brandur
brandur requested a review from bgentry October 31, 2026 03:52
@brandur brandur changed the title Move from chrono (deprecated) to jiff [rust] Move from chrono (deprecated) to jiff Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant