speedate
Fast and simple datetime, date, time, and duration parsing for Rust.
Repository Health
Technical Analysis
speedate is a fast, lightweight Rust library for parsing dates, times, datetimes, and durations. It is a lax RFC 3339 parser that accepts the common ISO 8601 formats developers actually encounter, and it also handles Unix timestamps in both seconds and milliseconds.
Built by the Pydantic team and used in performance-sensitive validation paths, speedate favors speed and simplicity: it parses directly into small, purpose-built date, time, datetime, and duration types without pulling in a heavy datetime framework, and it can run in no_std environments.
What You Get
- A lax RFC 3339 / ISO 8601 parser covering dates, times, datetimes, and durations
- Compact Date, Time, DateTime, and Duration types with simple parse constructors
- Timezone offset handling including Z, ±HH:MM, and ±HHMM forms
- Unix timestamp parsing in seconds and milliseconds with configurable units
- no_std compatibility and a dependency-light footprint tuned for speed
Common Use Cases
- Fast datetime validation and coercion in data-validation pipelines
- Parsing ISO 8601 timestamps from APIs, logs, or user input at scale
- Interpreting Unix timestamps as dates or datetimes with unit control
- Parsing ISO 8601 durations into structured time components
Under The Hood
Architecture — speedate is organized around one type per temporal concept: src/date.rs, src/time.rs, src/datetime.rs, and src/duration.rs each define a compact struct and its byte-level parser, sharing low-level numeric parsing in src/numbers.rs and helpers in src/util.rs. Parsing works directly over input bytes rather than allocating intermediate strings, which is the core of its speed. A src/config.rs module carries parsing options such as timestamp-unit interpretation, and src/lib.rs re-exports the public surface.
Tech Stack — Written in Rust (2021 edition), no_std-friendly with std behind a default feature (needed only for Date::today/DateTime::now). Dependencies are minimal and lean toward performance: arrayvec for stack buffers, lexical-parse-float for fast fractional-second parsing, and strum/strum_macros for enum ergonomics. Benchmarks and fuzz targets ship in-repo, with chrono and iso8601 used only as dev comparisons.
Code Quality — The crate is maintained by the Pydantic team with codecov coverage, a benches suite, and a fuzz harness guarding the byte-level parsers against malformed input. Splitting each temporal type into its own module keeps the parsing logic readable despite the manual byte handling, and the test suite exercises the many accepted format relaxations.
API Design — The API is intentionally tiny: call Date::parse_str, Time::parse_str, DateTime::parse_str, or Duration::parse_str and get back a typed value or a descriptive error. There is no builder ceremony and no framework to learn, and configuration is passed explicitly where needed. Documentation on docs.rs plus an extensive README format table make the supported inputs easy to discover.