news.volyx.in

Jiff: Datetime library for Rust (github.com)

448 points by goranmoomin · 750 days ago · 241 comments on HN

Article summary

Jiff is a datetime library for Rust that aims to provide high-level datetime primitives with reasonable performance. It supports automatic and seamless integration with the Time Zone Database, DST-aware arithmetic and rounding, and formatting and parsing zone-aware datetimes losslessly. The library is designed to be easy to use and hard to misuse. Jiff is available on crates.io and can be used by adding it to a project's dependencies in Cargo.toml.

Main themes

  • Rust datetime library
  • Time Zone Database integration
  • DST-aware arithmetic
  • Named function parameters
  • Struct default field values
  • Rust language features

What commenters say

  • The author of Jiff is also the author of the Rust regex ecosystem, which is a notable achievement.
  • Named function parameters would improve the readability of code, but their implementation is controversial and has been postponed.
  • Some commenters argue that struct default field values would be a useful feature, allowing for more concise and expressive code.
  • Others point out that the current implementation of `parse()` method on strings is based on the `FromStr` trait and is not an example of the extension trait pattern.
  • There is a desire for named parameters in Rust, similar to other languages, to improve code readability and usability.
  • The implementation of named parameters is complex and would require considering optional, named, and variadic parameters simultaneously.
  • Some commenters disagree on the usefulness of named parameters, with some seeing it as a minor issue and others as a significant improvement.
  • The Rust language's design and priorities are debated, with some arguing that named parameters are not a high priority feature.