Skip to content

Replace chrono feature with jiff - #148

Open
fabian-braun wants to merge 16 commits into
mainfrom
replace-chrono-with-jiff
Open

fabian-braun wants to merge 16 commits into
mainfrom
replace-chrono-with-jiff

Conversation

@fabian-braun

@fabian-braun fabian-braun commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • replace the optional chrono feature/dependency with jiff
  • port RFC3339 parse/format, Display, and conversion impls to jiff equivalents
  • document the breaking feature change and update the accepted infinity formatting expectation

Fixes #147

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces the optional chrono-backed integration with a jiff-backed one, migrating RFC3339 parsing/formatting, Display, and conversion impls behind a new jiff feature flag, and updates expectations around infinity formatting.

Changes:

  • Replace the optional chrono feature/dependency with jiff, including deleting src/chrono.rs and adding src/jiff.rs.
  • Port Time RFC3339 parse/format and Display/conversion impls to jiff equivalents, including ±∞ formatting for out-of-range values.
  • Update tests and changelog to reflect the feature rename and new formatting expectations.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/serde.rs Switch RFC3339 serde helper gating from chrono to jiff.
src/lib.rs Rename public feature module to jiff and adjust formatting-related tests.
src/jiff.rs New jiff-based formatting/parsing/conversion implementations and Display impls.
src/chrono.rs Removed chrono-based integration module.
CHANGELOG.md Document the breaking feature rename (chrono → jiff).
Cargo.toml Swap optional dependency/feature from chrono to jiff.
Cargo.lock Update lockfile to remove chrono-related crates and add jiff-related crates.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/jiff.rs
Comment thread CHANGELOG.md
Comment thread src/jiff.rs
fabian-braun and others added 3 commits June 15, 2026 18:35
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@fabian-braun
fabian-braun marked this pull request as ready for review June 15, 2026 18:09
@fabian-braun
fabian-braun requested a review from jankeu as a code owner June 15, 2026 18:09

@Felerius Felerius left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of switching! Some nitpicky comments below.

Comment thread src/jiff.rs Outdated
Comment thread src/jiff.rs Outdated
use crate::Time;
use crate::TimeWindow;

const RFC3339_FORMAT: &str = "%Y-%m-%dT%H:%M:%S+00:00";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Display of jiff::Timestamp creates an RFC3339 timestamp. Maybe we want to go through that instead of having this custom format string? That also avoids the discussion whether we want +00:00 vs Z.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in d213bbato_rfc3339/Display now go through the Display impl of jiff::Timestamp, so UTC renders as Z. Note this also means subsecond digits show up (2024-02-06T16:53:47.962Z); documented in the changelog.

Comment thread src/jiff.rs Outdated
Comment thread src/lib.rs Outdated
fabian-braun and others added 10 commits August 26, 2026 09:21
Co-Authored-By: Claude <noreply@anthropic.com>
Addresses review comment: the display/format tests belong next to the
jiff-backed implementations.

Co-Authored-By: Claude <noreply@anthropic.com>
Addresses review comment: go through the Display impl of
jiff::Timestamp instead of a custom strftime format string. UTC is now
rendered as "Z" and subsecond digits are included.

Co-Authored-By: Claude <noreply@anthropic.com>
Addresses review comment: the infinity cases can be handled by handing
the "∞" / "-∞" literal to strftime as the format string, which removes
the need for the FormattedTime wrapper.

Co-Authored-By: Claude <noreply@anthropic.com>
Addresses review comment: out-of-range durations can't be represented,
so surface that as an error instead of a debug assertion plus
saturation.

Co-Authored-By: Claude <noreply@anthropic.com>
jiff gates `impl std::error::Error for Error` behind its `std` feature, so
without it `jiff::Error` didn't integrate with the usual error handling.

Co-Authored-By: Claude <noreply@anthropic.com>
Otherwise the feature-gated items, such as `Time::format()`, are missing.

Co-Authored-By: Claude <noreply@anthropic.com>
`Timestamp::from_millisecond()` truncates its upper bound to a whole second,
which made the last 999 representable milliseconds render as "∞" and broke
the round trip from `Timestamp::MAX`. `Timestamp::from_duration()` doesn't.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@fabian-braun
fabian-braun requested a review from Felerius August 26, 2026 18:29
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.

Replace chrono with jiff

3 participants