diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2021-07-31 20:31:25 +0200 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2021-07-31 20:31:25 +0200 |
| commit | 1247ce7e43fc39c9e89f366dae16feb850671abc (patch) | |
| tree | c1ba9362c865a01ca35686389963c1e0a2b11151 /cli/src/search.rs | |
| parent | 0c3510f690760db93b540f46ad4716e8614ba775 (diff) | |
| download | money-1247ce7e43fc39c9e89f366dae16feb850671abc.tar.gz | |
on:date
Diffstat (limited to 'cli/src/search.rs')
| -rw-r--r-- | cli/src/search.rs | 8 |
1 files changed, 7 insertions, 1 deletions
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!(), }; |
