From 1247ce7e43fc39c9e89f366dae16feb850671abc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Sat, 31 Jul 2021 20:31:25 +0200 Subject: on:date --- cli/src/search.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'cli/src/search.rs') diff --git a/cli/src/search.rs b/cli/src/search.rs index a5e0309..0ad14ea 100644 --- a/cli/src/search.rs +++ b/cli/src/search.rs @@ -42,7 +42,7 @@ pub enum Constraint { Category(Category), Before(DateIsh), After(DateIsh), - //TODO On(DateIsh) + On(DateIsh) } enum FilterType { @@ -113,6 +113,11 @@ impl FilterType { FilterType::Union(Constraint::After(date)) => transaction.date >= date.clone().get(), + + FilterType::Intersect(Constraint::On(date)) + | FilterType::Subtract(Constraint::On(date)) + | FilterType::Union(Constraint::On(date)) + => transaction.date == date.clone().get(), } } } @@ -151,6 +156,7 @@ impl<'t> Search<'t> { ("category", category) => Constraint::Category(category.to_string()), ("before", date_ish) => Constraint::Before(DateIsh::parse(date_ish)), ("after", date_ish) => Constraint::After(DateIsh::parse(date_ish)), + ("on", date_ish) => Constraint::On(DateIsh::parse(date_ish)), _ => panic!(), }; -- cgit v1.2.1