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:
@ -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