diff --git a/src/main.rs b/src/main.rs index 308f2ce..9ae6518 100644 --- a/src/main.rs +++ b/src/main.rs @@ -106,9 +106,15 @@ fn log(f: &String, since: &Option) -> Result<(), String> { fn parse_time(since: &Option) -> Result { match since { Some(since) => { - match DateTime::parse_from_str(since, "%Y-%m-%d") { + match chrono::NaiveDate::parse_from_str(since, "%Y-%m-%d") { Ok(dt) => { - Err("not impl".to_string()) + Ok(UNIX_EPOCH.add( + Duration::from_secs( + dt.and_hms_opt(1, 1, 1) + .unwrap() + .timestamp() as u64 + ) + )) }, Err(msg) => Err(format!("failed to parse {}: {}", since, msg)), }