Create

Sign in to ReadmeX

or

How we handle your data: Privacy Policy

ReadmeX

Your AI reading companion

What would you like to catch up on?

Pick a briefing, or ask your own question.

Your community and people briefings stay personal to you.

jiff

jiff: A datetime library for Rust that encourages you to jump into the pit of success.

What problem it solves

Rust applications often need datetime handling that remains correct across time zones, daylight saving time transitions, arithmetic, rounding, formatting, and parsing. Jiff provides high-level primitives designed to be difficult to misuse while integrating with the Time Zone Database and supporting zone-aware datetime workflows.

Key features

  • High-level datetime primitives — The library focuses on high-level datetime types and operations that are difficult to misuse.

    Source: README

  • Time zone database integration — Jiff integrates with the Time Zone Database and supports zone-aware datetime operations across platforms.

    Source: README

  • DST-aware arithmetic and rounding — Arithmetic and rounding account for daylight saving time and preserve zone-aware behavior.

    Source: README

  • Formatting and parsing — Zone-aware datetimes can be formatted and parsed losslessly, including support for RFC 3339 instants.

    Source: README

  • Optional Serde support — Serde integration is available as an opt-in crate feature, alongside configuration for standard library support and embedded time zone data.

    Source: README

Quick start

Copied verbatim from the project's README.

$ cargo add jiff
use jiff::{Timestamp, ToSpan};

fn main() -> Result<(), jiff::Error> {
    let time: Timestamp = "2024-07-11T01:14:00Z".parse()?;
    let zoned = time.in_tz("America/New_York")?.checked_add(1.month().hours(2))?;
    assert_eq!(zoned.to_string(), "2024-08-10T23:14:00-04:00[America/New_York]");
    // Or, if you want an RFC3339 formatted string:
    assert_eq!(zoned.timestamp().to_string(), "2024-08-11T03:14:00Z");
    Ok(())
}

Who it may suit

This library may suit Rust developers building applications that need reliable timezone-aware datetime handling. It may also suit projects that want explicit, high-level datetime primitives with optional serialization support.

Topics to discuss

  • Which timezone and daylight saving time edge cases should the community prioritize testing?

  • Which crate features or interoperability workflows would benefit from additional examples and documentation?

  • How should the community shape contributions around platform support and embedded time zone data?


Written by ReadmeX AI from the project's README, source and public GitHub data; it may contain mistakes.

Read the original README https://github.com/BurntSushi/jiff#readme

ReadmeX opened this community for a trending project; it is not run by the project. Maintainers can claim it from the community page.

github.comhttps://github.com/BurntSushi/jiff

Comments

…