- #1286 Cannot use "sow", "som", etc in "entry.after", "end.after" filters
  (thanks to Jake Bell).
This commit is contained in:
Paul Beckingham 2013-10-06 15:30:35 -04:00
parent 316faaa411
commit 9099a353ea
3 changed files with 27 additions and 7 deletions

View file

@ -70,6 +70,8 @@ Bugs
+ #1270 The 'undo' command is now properly removing backlog entries. + #1270 The 'undo' command is now properly removing backlog entries.
+ #1279 Assorted corrections to the task-ref.pdf document (thanks to Benjamin + #1279 Assorted corrections to the task-ref.pdf document (thanks to Benjamin
Weber). 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. + #1300 Encode/decode pairing is now properly balanced.
+ #1305 Commit hash now available in tarball builds (thanks to Ben Boeckel). + #1305 Commit hash now available in tarball builds (thanks to Ben Boeckel).
+ #1352 Terminal crashes when using taskwarrior's zsh completion (thanks to + #1352 Terminal crashes when using taskwarrior's zsh completion (thanks to

View file

@ -853,8 +853,7 @@ bool Date::isRelativeDate (const std::string& input)
found == "eoww" || found == "eoww" ||
found == "eocw" || found == "eocw" ||
found == "sow" || found == "sow" ||
found == "soww" || found == "soww")
found == "socw")
{ {
if (found == "eow" || found == "eoww") if (found == "eow" || found == "eoww")
dow = 5; dow = 5;
@ -865,9 +864,6 @@ bool Date::isRelativeDate (const std::string& input)
if (found == "sow" || found == "soww") if (found == "sow" || found == "soww")
dow = 1; dow = 1;
if (found == "socw")
dow = Date::dayOfWeek (context.config.get ("weekstart"));
if (today.dayOfWeek () >= dow) if (today.dayOfWeek () >= dow)
today += (dow - today.dayOfWeek () + 7) * 86400; today += (dow - today.dayOfWeek () + 7) * 86400;
else else
@ -880,6 +876,28 @@ bool Date::isRelativeDate (const std::string& input)
_t = then._t; _t = then._t;
return true; 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") else if (found == "today")
{ {
Date then (today.month (), Date then (today.month (),

View file

@ -337,7 +337,7 @@ int main (int argc, char** argv)
t.ok (r11 < now + (8 * 86400), "eow < 7 days away"); t.ok (r11 < now + (8 * 86400), "eow < 7 days away");
Date r12 ("eocw"); 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"); Date r13 ("eom");
t.ok (r13.sameMonth (now), "eom in same month as now"); 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"); t.ok (r16 < now + (8 * 86400), "sow < 7 days away");
Date r23 ("socw"); 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"); Date r17 ("som");
t.notok (r17.sameMonth (now), "som not in same month as now"); t.notok (r17.sameMonth (now), "som not in same month as now");