diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2018-06-08 02:19:55 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2018-07-20 01:37:36 +0200 |
commit | 22d63f0946026aaad93daff370e1910b50f0e8c0 (patch) | |
tree | ef8a59c6b5f7e52fab72a73bd39984aacbf36cd8 /bin/domain/imag-diary | |
parent | 851db4abe4d8d0aebafe35ef41c5594213b1be6b (diff) |
Add functionality to create entry at a certain time
Diffstat (limited to 'bin/domain/imag-diary')
-rw-r--r-- | bin/domain/imag-diary/src/create.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/domain/imag-diary/src/create.rs b/bin/domain/imag-diary/src/create.rs index 148c4b5a..bc39765b 100644 --- a/bin/domain/imag-diary/src/create.rs +++ b/bin/domain/imag-diary/src/create.rs @@ -18,9 +18,10 @@ // use clap::ArgMatches; +use chrono::NaiveDateTime; +use chrono::Local; use libimagdiary::diary::Diary; -use libimagdiary::diaryid::DiaryId; use libimagdiary::error::DiaryErrorKind as DEK; use libimagdiary::error::ResultExt; use libimagentryedit::edit::Edit; @@ -130,7 +131,7 @@ fn create_id_from_clispec(create: &ArgMatches, diaryname: &str, timed_type: Time .map_err(|_| warn!("Could not parse minute: '{}'", s)) .ok() }) - .unwrap_or(time.minute()); + .unwrap_or(ndt.minute()); time.with_minute(min) .with_second(0) @@ -146,7 +147,7 @@ fn create_id_from_clispec(create: &ArgMatches, diaryname: &str, timed_type: Time .map_err(|_| warn!("Could not parse minute: '{}'", s)) .ok() }) - .unwrap_or(time.minute()); + .unwrap_or(ndt.minute()); let sec = create .value_of("second") @@ -156,7 +157,7 @@ fn create_id_from_clispec(create: &ArgMatches, diaryname: &str, timed_type: Time .map_err(|_| warn!("Could not parse second: '{}'", s)) .ok() }) - .unwrap_or(time.second()); + .unwrap_or(ndt.second()); time.with_minute(min).with_second(sec) }, |