Replace chrono with jiff in the Rust SDK

Merged
JE
2d ago
+260-405

RUSTSEC-2026-0543 marks chrono unmaintained, and #1105 put it on cargo-deny's ignore list until replacing it could be its own release. This is that release's change: the Rust SDK moves to jiff 1.x, and the ignore comes out.

Why jiff, and why now

  • chrono's maintainer soft-deprecated it in January (chronotope/chrono#1768), declined a handover and conversion help, and held the advisory "until after the jiff 1.0 release so as to minimize the number of ecosystem transitions". jiff 1.0 shipped 2026-11-15 with "an indefinite commitment to 1.x.y. Consumers of this library should feel confident about putting Jiff types into their public API." The floor is 1.0.1, which fixes an out-of-bounds timestamp parse. Its MSRV is 1.85; ours is 1.88.
  • time was the other candidate. It is still 0.x, its MSRV sits at our floor, it has no tz database, and its OffsetDateTime serde is not RFC 3339, so every generated field would need a with attribute.
  • The crate has no reverse dependencies on crates.io, so this is the cheapest the break will ever be.
  • The dependency graph shrinks: chrono, iana-time-zone, num-traits, autocfg, android_system_properties and the windows-core family go; jiff and jiff-core come in.

What changes

WasNow
basecamp_sdk::chronobasecamp_sdk::jiff
DateTime = chrono::DateTime<Utc>jiff::Timestamp
Date(pub chrono::NaiveDate)Date(pub jiff::civil::Date)
<Date as FromStr>::Err = chrono::ParseErrorjiff::Error
Token::expires_at, is_expired_at, parse_retry_after(_, now)jiff::Timestamp

The generator only names crate::types::{Date, DateTime, FlexibleTime}, so no generated code changes. MIGRATING.md has the upgrade notes.

What stays the same, and how it was checked

  • Instants. I compared chrono's DateTime<Utc> serde with jiff's Timestamp serde. They agree on .000Z, Z, numeric offsets (normalised to Z), a space separator, lowercase t/z and nine fractional digits. Both refuse a missing offset and a bare date. Output is byte-identical (2024-01-15T16:30:00.123Z). They differ only at the edges: a leap second reads as :59, and more than nine fractional digits is refused. jiff also reads T10:30Z and [zone] suffixes.
  • Dates. jiff's own civil::Date parser is wider: it takes 20260304, and 2026-03-04T00:00:00 with the time dropped. Date therefore stays a newtype and parses with strptime("%Y-%m-%d"), which matches chrono's %Y-%m-%d on every case probed. New tests pin the refusals. Date::default() stays 1970-01-01; jiff's own default is year zero.
  • Retry-After. The three RFC 9110 forms parse with jiff::civil::DateTime::strptime, including the weekday-mismatch refusal. The SPEC §6 test table passes unchanged.
  • Stored OAuth tokens. expires_at is RFC 3339 UTC either way, so a token stored by an earlier release reads back.
  • make rs-check passes locally: lint, tests, docs, cargo deny (advisories ok with an empty ignore list), drift, the publish check and verb refusal.

hey-sdk gets the same change in its own PR.


Summary by cubic

Replaces chrono with jiff in the Rust SDK because chrono is unmaintained (RUSTSEC-2026-0543). The wire format is unchanged, but DateTime becomes jiff::Timestamp, Date wraps jiff::civil::Date, and basecamp_sdk::chrono becomes basecamp_sdk::jiff.

  • Removes the chrono advisory from cargo-deny's ignore list.
  • Date still parses as YYYY-MM-DD and defaults to 1970-01-01, matching chrono's behavior.
  • Instants read and write identically to before, except that leap seconds read as 23:59:59 and more than nine fractional digits are refused rather than truncated.
  • Retry-After parsing and stored OAuth token expires_at values are unchanged.
  • MIGRATING.md documents the type-level changes; no generated code changes.