Repository navigation
Conversation
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
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 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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