mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Bug #1286
- #1286 Cannot use "sow", "som", etc in "entry.after", "end.after" filters (thanks to Jake Bell).
This commit is contained in:
parent
316faaa411
commit
9099a353ea
3 changed files with 27 additions and 7 deletions
|
@ -70,6 +70,8 @@ Bugs
|
|||
+ #1270 The 'undo' command is now properly removing backlog entries.
|
||||
+ #1279 Assorted corrections to the task-ref.pdf document (thanks to Benjamin
|
||||
Weber).
|
||||
+ #1286 Cannot use "sow", "som", etc in "entry.after", "end.after" filters
|
||||
(thanks to Jake Bell).
|
||||
+ #1300 Encode/decode pairing is now properly balanced.
|
||||
+ #1305 Commit hash now available in tarball builds (thanks to Ben Boeckel).
|
||||
+ #1352 Terminal crashes when using taskwarrior's zsh completion (thanks to
|
||||
|
|
28
src/Date.cpp
28
src/Date.cpp
|
@ -853,8 +853,7 @@ bool Date::isRelativeDate (const std::string& input)
|
|||
found == "eoww" ||
|
||||
found == "eocw" ||
|
||||
found == "sow" ||
|
||||
found == "soww" ||
|
||||
found == "socw")
|
||||
found == "soww")
|
||||
{
|
||||
if (found == "eow" || found == "eoww")
|
||||
dow = 5;
|
||||
|
@ -865,9 +864,6 @@ bool Date::isRelativeDate (const std::string& input)
|
|||
if (found == "sow" || found == "soww")
|
||||
dow = 1;
|
||||
|
||||
if (found == "socw")
|
||||
dow = Date::dayOfWeek (context.config.get ("weekstart"));
|
||||
|
||||
if (today.dayOfWeek () >= dow)
|
||||
today += (dow - today.dayOfWeek () + 7) * 86400;
|
||||
else
|
||||
|
@ -880,6 +876,28 @@ bool Date::isRelativeDate (const std::string& input)
|
|||
_t = then._t;
|
||||
return true;
|
||||
}
|
||||
|
||||
else if (found == "socw")
|
||||
{
|
||||
// day S M T W T F S
|
||||
// dow 0 1 2 3 4 5 6
|
||||
// -----------------------
|
||||
// weekstart ^
|
||||
// today1 ^
|
||||
// today2 ^
|
||||
//
|
||||
// delta1 = 6 <-- (0 - 1 + 7) % 7
|
||||
// delta2 = 3 <-- (4 - 1 + 7) % 7
|
||||
|
||||
dow = Date::dayOfWeek (context.config.get ("weekstart"));
|
||||
int delta = (today.dayOfWeek () - dow + 7) % 7;
|
||||
today -= delta * 86400;
|
||||
|
||||
Date then (today.month (), today.day (), today.year ());
|
||||
_t = then._t;
|
||||
return true;
|
||||
}
|
||||
|
||||
else if (found == "today")
|
||||
{
|
||||
Date then (today.month (),
|
||||
|
|
|
@ -337,7 +337,7 @@ int main (int argc, char** argv)
|
|||
t.ok (r11 < now + (8 * 86400), "eow < 7 days away");
|
||||
|
||||
Date r12 ("eocw");
|
||||
t.ok (r12 < now + (8 * 86400), "eocw < 7 days away");
|
||||
t.ok (r12 > now - (8 * 86400), "eocw < 7 days in the past");
|
||||
|
||||
Date r13 ("eom");
|
||||
t.ok (r13.sameMonth (now), "eom in same month as now");
|
||||
|
@ -352,7 +352,7 @@ int main (int argc, char** argv)
|
|||
t.ok (r16 < now + (8 * 86400), "sow < 7 days away");
|
||||
|
||||
Date r23 ("socw");
|
||||
t.ok (r23 < now + (8 * 86400), "sow < 7 days away");
|
||||
t.ok (r23 > now - (8 * 86400), "sow < 7 days in the past");
|
||||
|
||||
Date r17 ("som");
|
||||
t.notok (r17.sameMonth (now), "som not in same month as now");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue