Rust 语言专用 datetime 库 Jiff 正式发布 1.0 版本,开发者承诺除非发现重大缺陷,否则将无限期保持 API 兼容 1。该库专注于简化时区处理与夏令时转换,旨在通过“成功陷阱”设计减少用户错误,其灵感来源于 JavaScript 的 Temporal 提案但在 Rust 生态中独立实现 1。
Jiff 已在 uv、Cargo、Starship、fd、Nushell、mise 及 Jujutsu 等项目中投入生产环境使用 1。其核心概念涵盖 civil::Date、civil::Time、Timestamp、TimeZone 和 ZonedDateTime 1。在功能上,Jiff 支持 RFC 3339、RFC 9557、ISO 8601 标准以及自定义的“友好”持续时间格式,并默认采用“compatible”策略来处理夏令时导致的歧义(如折叠或间隙)1。
Jiff, a datetime library for the Rust programming language, has released version 1.0 1. The library focuses on simplifying timezone handling and daylight saving time transitions through a "trap of success" design intended to reduce user errors 1. The release promises indefinite compatibility unless major defects are discovered 1.
Jiff is already used in production environments by projects including uv, Cargo, Starship, fd, Nushell, mise, and Jujutsu 1. Its core concepts include civil::Date, civil::Time, Timestamp, TimeZone, and ZonedDateTime 1. To handle ambiguities caused by daylight saving time, such as folds or gaps, Jiff adopts a "compatible" strategy by default 1.
The library supports RFC 3339, RFC 9557, ISO 8601 standards, and a custom "friendly" duration format 1. Inspired by JavaScript’s Temporal proposal, Jiff is implemented independently within the Rust ecosystem and aims to offer advantages over other libraries like chrono and time 1.
评论
还没有评论,欢迎留下第一条。