| Crates.io | temporis |
| lib.rs | temporis |
| version | 1.0.2 |
| created_at | 2025-01-16 15:28:31.766237+00 |
| updated_at | 2025-01-16 15:35:39.313987+00 |
| description | Parse natural date strings into valid dates |
| homepage | https://github.com/paulchambaz/temporis |
| repository | |
| max_upload_size | |
| id | 1519385 |
| size | 298,310 |
A flexible Rust library for parsing human-friendly date expressions into NaiveDate objects. This library understands a wide variety of date formats and natural language expressions.
2024-01-1616-01-202416-Jan-2024, 2024-Jan-1616/01 (assumes current year)today, tomorrow, yesterdaymonday, tue, wednfriday, nmon2monday (2 Mondays from now)1st, 2nd, 3rd, 15thsow (start of week), eow (end of week)som (start of month), eom (end of month)soq (start of quarter), eoq (end of quarter)soy (start of year), eoy (end of year)eonw, eonm, eonq, eony (end of next week/month/quarter/year)5d, 5days2w, 2weeks3m, 3months1y, 1yearuse date_parser::parse_date;
fn main() -> Result<(), anyhow::Error> {
let date = parse_date("tomorrow")?;
println!("Tomorrow is: {}", date);
Ok(())
}
The library returns a Result<NaiveDate, anyhow::Error>, making it easy to handle parsing errors in your application.