summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cli/src/search.rs17
1 files changed, 3 insertions, 14 deletions
diff --git a/cli/src/search.rs b/cli/src/search.rs
index d4c107b..50ab32a 100644
--- a/cli/src/search.rs
+++ b/cli/src/search.rs
@@ -22,20 +22,9 @@ impl DateIsh {
// }
fn parse(i: &str) -> nom::IResult<&str, Self> {
map(
- map_opt(
- map_res(
- tuple((
- take(4usize),
- char('-'),
- take(2usize),
- char('-'),
- take(2usize),
- )),
- |(y, _, m, _, d): (&str, _, &str, _, &str)| -> Result<_, ParseIntError> {
- Ok((y.parse()?, m.parse()?, d.parse()?))
- }
- ),
- |(y, m, d)| NaiveDate::from_ymd_opt(y, m, d)
+ map_res(
+ take(10usize),
+ |s| NaiveDate::parse_from_str(s, "%Y-%m-%d"),
),
DateIsh::Absolute
)(i)