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
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 (),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue