rework of remind command. updated a dep. fixed an issue in parsing absolute times

This commit is contained in:
2020-11-29 00:36:42 +00:00
parent 55437b76eb
commit 3879c83085
5 changed files with 121 additions and 144 deletions

View File

@ -43,7 +43,7 @@ impl TryFrom<&TimeParser> for i64 {
}
impl TimeParser {
pub fn new(input: String, timezone: Tz) -> Self {
pub fn new(input: &str, timezone: Tz) -> Self {
let inverted = input.starts_with('-');
let parse_type = if input.contains('/') || input.contains(':') {
@ -104,7 +104,7 @@ impl TimeParser {
}
} else {
Ok("".to_string())
}? + if segments == 1 {
}? + {
let colons = self.time_string.matches(':').count();
match colons {
@ -112,8 +112,6 @@ impl TimeParser {
2 => Ok("%H:%M:%S"),
_ => Err(InvalidTime::ParseErrorHMS),
}
} else {
Ok("")
}?;
let dt = self