← Back to Pull requests

Add support for `jiff` date and time types #5390

Closed
unknown closed this pull request without merging on Nov 24, 2026 11:09 UTC
View on GitHub
unknown unknown commented on Nov 16, 2026 07:22 UTC
Author

jiff@1.0.0 was released yesterday, so it's time to add support here, as suggested by https://github.com/diesel-rs/diesel/discussions/5141#discussioncomment-17871211.

With this PR Diesel can now map jiff date and time types without a wrapper crate. With the new jiff feature jiff::civil::Date, jiff::civil::Time and jiff::civil::DateTime map to Date, Time and Timestamp on PostgreSQL, SQLite, MySQL and MariaDB. jiff::civil::DateTime also maps to Datetime on MySQL and MariaDB, and jiff::Timestamp maps to Timestamptz on PostgreSQL.

The encodings follow the existing chrono and time integrations. In a few places the new code is deliberately stricter:

  • The civil types carry no time zone, so they don't map to Timestamptz or TimestamptzSqlite.

  • SQLite decoding accepts a Z suffix but rejects +HH:MM offsets. SQLite shifts those values to UTC, so ignoring the offset would return a different time. The chrono and time integrations currently seem to ignore it.

  • MySQL decoding rejects negative TIME values and values with a time zone displacement. A jiff type can't represent either one correctly.
  • Compared to jiff-diesel, users no longer need newtype wrappers, and MariaDB is supported too. SQLite values are now written with a space separator and four-digit years, like chrono and time and the native SQLite format. jiff-diesel writes jiff's ISO format with a T separator instead, which this impl can still read though. jiff-diesel also decodes Interval into Span, but a PostgreSQL interval can mix signs between its components, while a Span has a single sign. That conversion is left out on purpose, together with jiff::Timestamp on SQLite and MySQL, SignedDuration and Zoned. Each of these can follow in a separate PR.

    AI disclosure: I used Claude Opus 5.5 in Claude Code to investigate, plan and implement the changes with human-in-the-loop.

  • I checked for similar changes and make sure to reference them

  • I included a changelog entry for relevant new features or changes
  • Related

  • #5141

  • #4995

  • BurntSushi/jiff#384

  • BurntSushi/jiff#251
  • Diff: 271 lines (+203 / -68) across 3 files Reviewer: Turbo87 Review duration: 11746m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 271 lines diff across 3 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.335
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #5390"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39.5% (MEDIUM) · Higher = larger blast radius
    39.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.6% · Safe to merge
    15.6%