Chrono

Timezone-aware date and time handling for Rust, with correct calendar operations and flexible strftime-style formatting.

Library
Cargo
v0.4.45
3,913 stars
MIT OR Apache-2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
73 /100 Good
Development Activity 56
Maintenance 64
Community 72
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
84 /100 Excellent
Architecture 88
Code Quality 85
Innovation 82
Learning Curve 85

Chrono is the de facto standard date and time library for Rust, providing timezone-aware DateTime types alongside naive, timezone-agnostic equivalents. It implements the proleptic Gregorian calendar with correct handling of leap years and ambiguous or invalid local times, returning Option or a dedicated MappedLocalTime enum rather than panicking on edge cases.

With over 680 million downloads on crates.io, Chrono underpins the Rust ecosystem’s date and time needs across web services, CLIs, and embedded targets. It ships no_std-compatible core types via opt-in alloc/std features, supports strftime-style parsing and formatting, integrates with Serde for serialization, and pairs with the companion chrono-tz crate for full IANA timezone database support.

What You Get

  • Timezone-aware DateTime<Tz> and naive (timezone-agnostic) NaiveDate/NaiveTime/NaiveDateTime types
  • strftime/strptime-style formatting and parsing via the format module
  • TimeDelta (duration) arithmetic with checked, non-panicking operations
  • Optional Serde support for serializing and deserializing date and time types
  • A no_std core with opt-in alloc, std, and clock features for constrained targets
  • WASM support via the wasmbind feature, interfacing with the JS Date API

Common Use Cases

  • Web service timestamps - Backend services use DateTime<Utc> to record and compare event timestamps consistently across time zones.
  • Log and report formatting - CLI tools and reporting pipelines use Chrono’s strftime-style formatting to render human-readable dates.
  • User-facing scheduling - Applications that convert between a user’s local time and UTC, such as calendars and reminders, rely on Local and FixedOffset conversions.
  • Data parsing - ETL and data-processing code parses date and time strings from external APIs and files using Chrono’s flexible parsing.

Under The Hood

Architecture - Chrono splits into a naive, timezone-agnostic layer (src/naive/{date,time,datetime}) and a timezone-aware layer (src/datetime/mod.rs), which wraps a naive datetime together with an offset implementation such as src/offset/{utc.rs,fixed.rs,local}, unified via the TimeZone trait in src/traits.rs so that DateTime<Tz> is generic over any offset type. The format module (src/format/{parse.rs,formatting.rs,strftime.rs,scan.rs}) implements a token-based, strftime-inspired parser and formatter decoupled from the core date types via an intermediate Parsed struct (src/format/parsed.rs), while low-level calendar arithmetic for the proleptic Gregorian calendar is isolated in src/naive/internals.rs, keeping day-counting math out of the public API surface.

Tech Stack - Chrono is a pure-Rust crate (100% Rust per repository language stats), targeting edition 2021 with an MSRV of 1.62. Its only non-optional dependency is num-traits for generic numeric trait bounds; everything else (serde, rkyv, arbitrary, defmt, pure-rust-locales, wasm-bindgen/js-sys, windows-link, iana-time-zone) is gated behind opt-in Cargo features, reflecting a no_std-first design where even std, alloc, and clock are themselves feature flags. Platform-specific dependencies are split via target.'cfg(...)' sections in Cargo.toml for wasm, Windows, and Unix targets.

Code Quality - The crate carries 333 #[test]-annotated tests embedded alongside implementation code (e.g. src/datetime/tests.rs), plus integration tests under tests/ and dedicated fuzz/ and bench/ directories for fuzzing and performance regression tracking. CI, defined in .github/workflows/test.yml and lint.yml, runs against the pinned MSRV toolchain. The codebase favors returning Option/MappedLocalTime over panicking for fallible operations, per the README’s explicit design goal; internal unwrap() calls that do appear are concentrated in code paths already guarded by prior range checks, a common and accepted pattern in systems-level Rust rather than unchecked risk. Naming is consistently idiomatic Rust (snake_case functions, PascalCase types) throughout.

API Design - Chrono’s public API centers on a small set of composable types (DateTime<Tz>, NaiveDate, NaiveTime, NaiveDateTime, TimeDelta) with consistent constructor and accessor naming (e.g. from_ymd_opt, with_hour) that return Option rather than panicking on invalid input. Roughly 9,500 lines of /// doc comments across the crate give near-complete rustdoc coverage with runnable examples. Getting started requires almost no boilerplate — Utc::now() or NaiveDate::from_ymd_opt(...) — though the naive-vs-timezone-aware type split and the number of Cargo feature flags needed for full functionality (clock, alloc, serde, unstable-locales) add a real, if well-documented, learning curve for newcomers used to simpler date libraries.

Used by 59 apps in this directory

TypeScript
95%
Apache 2.0

Void

AI Code Assistants · Automation · Code Editors

28,786

Open-source AI code editor with direct LLM integration and data privacy

View details
45
Repo Health
84
Technical
68
Dependency
Built with
TypeScript 95%
Updated 4 months ago
Rust
97%
Apache 2.0

Volga

Data Engineering

161

A Rust-based real-time data processing engine for AI/ML feature computation, built on Apache DataFusion and Arrow — positioned as an alternative to Flink, Spark, Chronon, and OpenMLDB with unified streaming, batch, and request-time execution.

View details
67
Repo Health
67
Technical
72
Dependency
Built with
Rust 97%
Updated 6 days ago
Rust
32%
Other

Windmill

Automation · Developer Tools

18,043

Turn scripts into webhooks, workflows, and auto-generated UIs — the fastest self-hostable workflow engine, 13x faster than Airflow.

View details
91
Repo Health
82
Technical
65
Dependency
Built with
Rust 32%
TypeScript 24%
Svelte 22%
Updated 5 days ago
Python
65%
Apache 2.0

WrenAI

AI Agents · Analytics · Data Engineering

17,763

Open-source GenBI engine that lets AI agents turn natural-language questions into governed SQL, charts, and shareable dashboards across 20+ data sources — no vendor lock-in, no black-box prompts.

View details
90
Repo Health
91
Technical
69
Dependency
Built with
Python 65%
Rust 32%
Updated 1 weeks ago
TypeScript
41%
MIT

YuE2 Studio

Mcp · Music Audio

413

Windows desktop studio that runs the YuE2 song model on your own NVIDIA GPU: it writes an editable sheet-music score first, then sings it as a full song with vocals, offline, with covers, LoRA training and an MCP server for agents.

View details
71
Repo Health
83
Technical
76
Dependency
Built with
TypeScript 41%
Rust 36%
JavaScript 21%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers