flags complete

main v0.0.1
Bel LaPointe 2023-11-29 06:27:54 -07:00
parent d580122f76
commit caa09089b0
1 changed files with 8 additions and 2 deletions

View File

@ -106,9 +106,15 @@ fn log(f: &String, since: &Option<String>) -> Result<(), String> {
fn parse_time(since: &Option<String>) -> Result<SystemTime, String> {
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)),
}