Date Time Parser
Parse English natural-language dates and times in Rust into chrono NaiveDate and NaiveTime values.
Repository Health
Technical Analysis
Date Time Parser is a Rust natural-language processing library that turns unstructured English text into structured dates and times. Given a phrase like “Lunch on June 5th” it extracts the date and returns it as a chrono NaiveDate, and it does the same for times. It supports parsing relative to the current moment or a custom reference point, and can be timezone aware while defaulting to UTC. It is the date/time core beneath the broader event-parser project.
What You Get
- A
DateParserthat extracts aNaiveDatefrom free-form English text - A
TimeParserthat extracts aNaiveTimefrom natural-language phrases - Relative parsing anchored to the current time or a custom reference point
- Timezone-aware behavior that defaults to UTC when none is given
Common Use Cases
- Turning typed phrases like “next Friday” into concrete calendar dates
- Extracting a due date or time from user-entered task text
- Powering the date logic behind a natural-language calendar or reminder tool
Under The Hood
Architecture
date_time_parser is one crate in a two-member workspace alongside event_parser. The date crate exposes DateParser and TimeParser, each of which runs the input through an ordered set of regular expressions that match date and time patterns, then maps captured groups onto chrono calendar arithmetic. Relative expressions are resolved against a reference NaiveDate/NaiveTime, defaulting to the current UTC moment, and the higher-level event_parser crate composes these results into iCalendar-style events.
Tech Stack
Built directly on chrono for calendar types and arithmetic and regex for pattern matching, targeting Rust edition 2018 with no other runtime dependencies. It is a pure library published to crates.io as date_time_parser, with a companion CLI client in the repository demonstrating usage.
Code Quality
The crate is small - about five source files - with three test files exercising the parser against representative phrases, and a docs directory for the project. Being an early-stage 0.x library the expression coverage is finite and maintenance is infrequent, but the regex-driven approach keeps each rule readable and independently testable.
API Design
The public surface is tiny and predictable: call DateParser::parse or TimeParser::parse with a string and receive an Option of a chrono type. Returning standard chrono types rather than a bespoke representation means results integrate immediately with existing date handling, and the quickstart in the README is enough to get productive.