human-chrono-parser 0.0.1

Parse human-written relative dates like "today" ,"tomorrow", "in 3 days", "next monday" and other variants.
Documentation
  • Coverage
  • 0%
    0 out of 8 items documented0 out of 4 items with examples
  • Size
  • Source code size: 25.12 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.74 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 20s Average build duration of successful builds.
  • all releases: 20s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • ecarrara/human-chrono-parser
    5 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ecarrara

human-chrono-parser

Parse human-written relative dates like "today" ,"tomorrow", "in 3 days", "next monday" and other variants.

Installation

To use the human-chrono-parser in your project, include it in your Cargo.toml:

[dependencies]
human-chrono-parser = "0.0.1"

Usage

Here is a basic example of how to use the HumanDateParser trait:

use chrono::{Days, NaiveDate};
use human_chrono_parser::{locales::pt_br::HumanDateParserBrazillianPortuguese, HumanDateParser};

fn main() {
    let now = NaiveDate::from_ymd_opt(2024, 8, 13).unwrap(); // Example: Tuesday, August 13, 2024

    let tommorow = HumanDateParserBrazillianPortuguese::parse_relative("amanhã", now);
    println!("{:?}", tommorow); // Some(2024-08-14)

    assert_eq!(tommorow, now.checked_add_days(Days::new(1)));
}

Locales

Currently only pt-BR locale is supported. We welcome contributions to support other locales!

Contributing

Contributions are welcome! If you'd like to improve the library or add more features, please open an issue, fork the repository and create a pull request.