hn.today

Jiff – A datetime library for Rust – reaches 1.0

burntsushi.net15 points2 comments
Screenshot of Jiff – A datetime library for Rust – reaches 1.0

Jiff 1.0 is a Rust datetime library release aimed at making date and time operations safer by modeling their real-world complexity instead of leaving it to each programmer. The release formalizes a long-term stability commitment: because Jiff is already used in production and may appear in other libraries’ public APIs, incompatible changes will be made only for significant defects. The library’s central concern is the gap between machine time and human civil time, especially the way time-zone rules can make a local clock reading ambiguous or invalid.

Jiff organizes its types in layers: a civil date and time describe a calendar reading without a location; a timestamp identifies one instant; a time zone maps between instants and local readings; and a zoned datetime combines all three. Its examples show conversions in both directions and explain how daylight-saving transitions create repeated or skipped times. By default, Jiff resolves ambiguity compatibly, while its API also lets callers choose the earlier or later interpretation or require an unambiguous result. The release tour also covers duration representations, parsing and formatting, date arithmetic and rounding, other calendars, span manipulation, and ICU4X-based locale-sensitive formatting. Together, these features make time-zone handling central to the API and aim to reduce common datetime mistakes.

Read on burntsushi.net2 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

Aristotle Expands into Rust

Aristotle has expanded its formal verification platform to Rust, allowing developers to prove code meets specifications and contains no undefined behavior, including in unsafe blocks. It can also verify that Rust rewrites behave like their original C code, targeting critical software such as smart contracts and infrastructure. (harmonic.fun)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.