From caa09089b01300a0842a4bd5de3a8796bc8baf7d Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Wed, 29 Nov 2023 06:27:54 -0700 Subject: [PATCH] flags complete --- src/main.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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)), }