From cfac0c42e8649e5eb27eddc7ce7b3c7e4011b52c Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 31 Dec 2012 08:48:57 -0500 Subject: [PATCH] Dates + Fixed bug with 'socm' date calculation that failed on some days, by simplifying the implementation. --- ChangeLog | 2 ++ src/Date.cpp | 14 +++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index cf9a241ef..a4d121bb8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -71,6 +71,8 @@ Bugs abbreviation.minimum is greater than 4. + Fixed bug where shadow files are not properly created when there is a missing .taskrc file (thanks to Pietro Cerutti). + + Fixed bug with 'socm' date calculation that failed on some days, by + simplifying the implementation. ------ old releases ------------------------------ diff --git a/src/Date.cpp b/src/Date.cpp index e4b87df7f..68060a019 100644 --- a/src/Date.cpp +++ b/src/Date.cpp @@ -830,8 +830,7 @@ bool Date::isRelativeDate (const std::string& input) found == "eocw" || found == "sow" || found == "soww" || - found == "socw" || - found == "socm") + found == "socw") { if (found == "eow" || found == "eoww") dow = 5; @@ -850,9 +849,6 @@ bool Date::isRelativeDate (const std::string& input) else today += (dow - today.dayOfWeek ()) * 86400; - if (found == "socm") - today -= (today.day () - 1) * 86400; - int m, d, y; today.toMDY (m, d, y); Date then (m, d, y); @@ -907,6 +903,14 @@ bool Date::isRelativeDate (const std::string& input) _t = then._t; return true; } + else if (found == "socm") + { + int m = today.month (); + int y = today.year (); + Date then (m, 1, y); + _t = then._t; + return true; + } else if (found == "som") { int m = today.month () + 1;