You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Bradlee Speice 440ba918f6 Version 1.2.0 7 months ago
ci Test adding WASM support 2 years ago
examples Rustfmt 1 year ago
src Handle panic from large integers 7 months ago
.gitignore Test adding WASM support 2 years ago
.travis.yml Fix ENV naming 11 months ago Release version 1.0.3 2 years ago Remove fuzzing, add CONTRIBUTING/CONTRIBUTORS 2 years ago Add one final CONTRIBUTOR 2 years ago
Cargo.toml Version 1.2.0 7 months ago
LICENSE Licensing/docs updates 2 years ago Remove Appveyor badge from README 11 months ago
bors.toml Simplify testing procedure 11 months ago Add fixes for dateutil/dateutil#822 11 months ago Remove a last println and use a static default parser 2 years ago



The fully-featured “even I couldn't understand that” time parser. Designed to take in strings and give back sensible dates and times.

dtparse has its foundations in the dateutil library for Python, which excels at taking “interesting” strings and trying to make sense of the dates and times they contain. A couple of quick examples from the test cases should give some context:

extern crate chrono;
extern crate dtparse;
use chrono::prelude::*;
use dtparse::parse;

    Ok((NaiveDate::from_ymd(2008, 12, 30).and_hms(0, 0, 0), None))

// It can even handle timezones!
    parse("January 4, 2024; 18:30:04 +02:00"),
        NaiveDate::from_ymd(2024, 1, 4).and_hms(18, 30, 4),

And we can even handle fuzzy strings where dates/times aren't the only content if we dig into the implementation a bit!

extern crate chrono;
extern crate dtparse;
use chrono::prelude::*;
use dtparse::Parser;
use std::collections::HashMap;

let mut p = Parser::default();
        "I first released this library on the 17th of June, 2018.",
        None, None,
        true /* turns on fuzzy mode */,
        true /* gives us the tokens that weren't recognized */,
        None, false, &HashMap::new()
        NaiveDate::from_ymd(2018, 6, 17).and_hms(0, 0, 0),
        Some(vec!["I first released this library on the ",
                  " of ", ", "].iter().map(|&s| s.into()).collect())

Further examples can be found in the examples directory on international usage.


dtparse requires a minimum Rust version of 1.28 to build, but is tested on Windows, OSX, BSD, Linux, and WASM. The build is also compiled against the iOS and Android SDK's, but is not tested against them.