citum-edtf 0.69.0

A modern EDTF (Extended Date/Time Format) parser built with winnow.
Documentation

citum-edtf

A modern parser for the Extended Date/Time Format (ISO 8601-2:2019), implementing EDTF Level 0 and Level 1. Built on winnow for zero-allocation parsing.

Used by the Citum citation engine for date handling in bibliographic references, but has no Citum-specific dependencies — usable standalone for any project that needs EDTF date parsing.

Usage

The primary entry point is the FromStr impl on Edtf:

use citum_edtf::Edtf;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let date: Edtf        = "2024-03-15".parse()?;
    let approximate: Edtf = "2024~".parse()?;
    let interval: Edtf    = "2020/2024".parse()?;
    let season: Edtf      = "2024-22".parse()?;  // summer
    Ok(())
}

FromStr consumes the entire string and returns a ParseError on failure.

For streaming or parser-combinator use cases where you need to consume only a prefix and leave the rest in place, use the lower-level parse and parse_date functions, which follow the winnow &mut &str convention.

Supported syntax includes negative years, year precision, month/day precision, approximations (~), uncertainty (?), unspecified digits (X), intervals, seasons, and decade/century precision.

Project

Part of Citum, a modern citation engine in Rust.

License

Dual-licensed under MIT or Apache-2.0 at your option.