TimeParser into i64. Generic argument across create_reminder. Some more work on natural inc. splitting off first args and calling the subprocess
This commit is contained in:
1 parent
980a8d2a9c
commit
8e99cc088a
7 files changed
+95
-11
No files matched your search
@@ -11,6 +11,7 @@ use std::fmt::{
|
||||
|
||||
use chrono_tz::Tz;
|
||||
use chrono::TimeZone;
|
||||
use std::convert::TryFrom;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum InvalidTime {
|
||||
@@ -40,6 +41,14 @@ pub struct TimeParser {
|
||||
parse_type: ParseType,
|
||||
}
|
||||
|
||||
impl TryFrom<&TimeParser> for i64 {
|
||||
type Error = InvalidTime;
|
||||
|
||||
fn try_from(value: &TimeParser) -> Result<Self, Self::Error> {
|
||||
value.timestamp()
|
||||
}
|
||||
}
|
||||
|
||||
impl TimeParser {
|
||||
pub fn new(input: String, timezone: Tz) -> Self {
|
||||
let inverted = if input.starts_with("-") {
|
||||
|
||||
Reference in new issue
Block a user