fuzzydate

Crates.iofuzzydate
lib.rsfuzzydate
version0.3.1
created_at2022-02-17 06:10:10.564767+00
updated_at2025-11-27 04:02:38.462084+00
descriptionA flexible natural language date parsing library
homepage
repositoryhttps://github.com/DevinVS/fuzzydate
max_upload_size
id533898
size97,824
Connor Keane (Kxnr)

documentation

README

fuzzydate

fuzzydate on crates.io fuzzydate on docs.rs

fuzzydate parses human-friendly date/time phrases (for example: "five days after this Friday", "tomorrow at noon", "3 weeks ago") and returns chrono datetimes. The current time (or a passed alternative), is used for any values not specified by the phrase and for any operations that are relative to an existing time, like 5 days ago. By default, fuzzydate uses the current time and system timezone.

Quick links

Install

Add to your Cargo.toml:

[dependencies]
fuzzydate = "0.3"

Examples

For full grammar reference, see the documentation.

use fuzzydate::parse;

fn main() -> Result<(), fuzzydate::Error> {
    let dt = parse("five days after this friday")?;
    println!("{:?}", dt);
    Ok(())
}

Additional functions are available to parse datetimes with an alternative current time and parse in a timezone other than the system timezone:

use fuzzydate::aware_parse;
use chrono::offset::Utc;
use chrono::prelude::*;

fn main() -> Result<(), fuzzydate::Error> {
    let dt = aware_parse("tomorrow at noon", Utc::now(), Utc)?;
    println!("{}", dt);
    Ok(())
}
Commit count: 69

cargo fmt