From ac3572a4f5e81db98b45ea4b00e159b6ad3bcd63 Mon Sep 17 00:00:00 2001 From: Scott Mcdermott Date: Sat, 17 Jul 2021 17:22:41 -0700 Subject: [PATCH] CLI2: New filter attribute modifier "by", uses '<=' for comparison This patch allows e.g. due.by:tomorrow that includes all of tomorrow, because it uses less than or equal to, rather than just less than, like 'before' modifier does. This allows matching the last second of the day when filtering by "due.by:eod", and more generally allows date filters with an inclusive end-interval specification. Closes #2536 --- src/CLI2.cpp | 5 +++++ src/Context.cpp | 1 + 2 files changed, 6 insertions(+) diff --git a/src/CLI2.cpp b/src/CLI2.cpp index 4c5743865..e7f545636 100644 --- a/src/CLI2.cpp +++ b/src/CLI2.cpp @@ -1341,6 +1341,11 @@ void CLI2::desugarFilterAttributes () op.attribute ("raw", ">"); rhs.attribute ("raw", value); } + else if (mod == "by") + { + op.attribute ("raw", "<="); + rhs.attribute ("raw", value); + } else if (mod == "none") { op.attribute ("raw", "=="); diff --git a/src/Context.cpp b/src/Context.cpp index d13b105ec..d6e58463e 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -397,6 +397,7 @@ static const char* modifierNames[] = { "before", "under", "below", "after", "over", "above", + "by", "none", "any", "is", "equals",