mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
- Fixed bug where relative dates in filters (task list due:eom,
task list due:tomorrow, task list due:23rd ...) are now properly supported.
This commit is contained in:
parent
df215f228d
commit
e9a71b7db9
6 changed files with 54 additions and 4 deletions
|
@ -20,6 +20,8 @@ represents a feature release, and the Z represents a patch.
|
|||
the new "default.project" and "default.priority" configuration variables
|
||||
(thanks to Vincent Fleuranceau)
|
||||
+ Task supports improved word-wrapping to the terminal width
|
||||
+ Bug: Now properly supports relative dates in filters (task list due:eom,
|
||||
task list due:tomorrow, task list due:23rd ...)
|
||||
|
||||
------ old releases ------------------------------
|
||||
|
||||
|
|
|
@ -104,6 +104,9 @@
|
|||
the new "default.project" and "default.priority" configuration variables
|
||||
(thanks to Vincent Fleuranceau).
|
||||
<li>Task supports improved word-wrapping to the terminal width.
|
||||
<li>Fixed bug so that relative dates in filters (task list due:eom,
|
||||
task list due:tomorrow, task list due:23rd ...) are now properly
|
||||
supported.
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
|
|
21
src/Date.cpp
21
src/Date.cpp
|
@ -543,22 +543,35 @@ bool Date::isRelativeDate (const std::string& input)
|
|||
else
|
||||
today += (dow - today.dayOfWeek ()) * 86400;
|
||||
|
||||
mT = today.mT;
|
||||
int m, d, y;
|
||||
today.toMDY (m, d, y);
|
||||
Date then (m, d, y);
|
||||
|
||||
mT = then.mT;
|
||||
return true;
|
||||
}
|
||||
else if (found == "today")
|
||||
{
|
||||
mT = today.mT;
|
||||
Date then (today.month (),
|
||||
today.day (),
|
||||
today.year ());
|
||||
mT = then.mT;
|
||||
return true;
|
||||
}
|
||||
else if (found == "tomorrow")
|
||||
{
|
||||
mT = today.mT + 86400;
|
||||
Date then (today.month (),
|
||||
today.day (),
|
||||
today.year ());
|
||||
mT = then.mT + 86400;
|
||||
return true;
|
||||
}
|
||||
else if (found == "yesterday")
|
||||
{
|
||||
mT = today.mT - 86400;
|
||||
Date then (today.month (),
|
||||
today.day (),
|
||||
today.year ());
|
||||
mT = then.mT - 86400;
|
||||
return true;
|
||||
}
|
||||
else if (found == "eom")
|
||||
|
|
|
@ -79,6 +79,7 @@ void filter (std::vector<T>& all, T& task)
|
|||
// Apply attribute filter.
|
||||
matches = 0;
|
||||
foreach (a, attrList)
|
||||
{
|
||||
if (a->first == "project")
|
||||
{
|
||||
if (a->second.length () <= refTask.getAttribute (a->first).length ())
|
||||
|
@ -87,6 +88,7 @@ void filter (std::vector<T>& all, T& task)
|
|||
}
|
||||
else if (a->second == refTask.getAttribute (a->first))
|
||||
++matches;
|
||||
}
|
||||
|
||||
if (matches == attrList.size ())
|
||||
{
|
||||
|
|
15
src/tests/in
Executable file
15
src/tests/in
Executable file
|
@ -0,0 +1,15 @@
|
|||
./task add monday due:monday
|
||||
./task add tuesday due:tuesday
|
||||
./task add wednesday due:wednesday
|
||||
./task add thursday due:thursday
|
||||
./task add friday due:friday
|
||||
./task add saturday due:saturday
|
||||
./task add sunday due:sunday
|
||||
./task add yesterday due:yesterday
|
||||
./task add today due:today
|
||||
./task add tomorrow due:tomorrow
|
||||
./task add eow due:eow
|
||||
./task add eom due:eom
|
||||
./task add eoy due:eoy
|
||||
./task add 21st due:21st
|
||||
|
15
src/tests/out
Executable file
15
src/tests/out
Executable file
|
@ -0,0 +1,15 @@
|
|||
./task li due:monday
|
||||
./task li due:tuesday
|
||||
./task li due:wednesday
|
||||
./task li due:thursday
|
||||
./task li due:friday
|
||||
./task li due:saturday
|
||||
./task li due:sunday
|
||||
./task li due:yesterday
|
||||
./task li due:today
|
||||
./task li due:tomorrow
|
||||
./task li due:eow
|
||||
./task li due:eom
|
||||
./task li due:eoy
|
||||
./task li due:21st
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue