diff --git a/ChangeLog b/ChangeLog index dd719f605..677fac0f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -38,7 +38,6 @@ + The configuration variable 'json.array' determines whether 'query' command output is enclosed by '[...]'. + The duration 'm' is now interpreted as 'months', not 'minutes'. - + New "eoq" and "soq" dates for the end and start of quarter. # Tracked Features, sorted by ID. + Added feature #278, which provides a more consistent command line grammar. @@ -96,6 +95,8 @@ controlled by '#define HAVE_EXECUTE 1' in cmake.h. This allows a build that does not have the potential security hole, in the event that taskwarrior is run at elevated privilege, or run in the context of a web server. + + Added feature #813, new "eoq" and "soq" dates for the end and start of quarter. + (thanks to Dave French and Paulo Almeida for the patch) # Tracked Bugs, sorted by ID. + Fixed bug #403, which disambiguates certain commands involving numbers. diff --git a/src/Date.cpp b/src/Date.cpp index b11dfda8c..89fb6e178 100644 --- a/src/Date.cpp +++ b/src/Date.cpp @@ -881,20 +881,10 @@ bool Date::isRelativeDate (const std::string& input) } else if (found == "eoq") { - int m = today.month (); - int y = today.year (); - int q; - if (m <= 3) - q = 3; - else if (m >= 4 && m <= 6) - q = 6; - else if (m >= 7 && m <= 9) - q = 9; - else - q = 12; - Date then (q, - Date::daysInMonth (q, y), - y); + int eoq_month = today.month () + 2 - (today.month () - 1) % 3; + Date then (eoq_month, + daysInMonth (eoq_month, today.year ()), + today.year ()); _t = then._t; return true; } @@ -919,20 +909,14 @@ bool Date::isRelativeDate (const std::string& input) } else if (found == "soq") { - int m = today.month (); + int m = today.month () + 3 - (today.month () - 1) % 3; int y = today.year (); - int q; - if (m <= 3) - q = 1; - else if (m >= 4 && m <= 6) - q = 4; - else if (m >= 7 && m <= 9) - q = 7; - else - q = 10; - Date then (q, - 1, - y); + if (m > 12) + { + m -=12; + y++; + } + Date then (m , 1, y); _t = then._t; return true; }