From b2eb9c3265e04d6dbd26fdda2f042777f2d274a5 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 27 Jun 2010 16:55:29 -0400 Subject: [PATCH] Bug #405 - after upgrade, "due:" filter not working for tasks created in version 1.9.0 - Fixed bug #405, which incorrectly compared dates on tasks created by versions earlier than 1.9.1 to those created by 1.9.1 or later (thanks to Ivo Jimenez). --- ChangeLog | 3 +++ src/Att.cpp | 20 ++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0de9dc233..5b100eab9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -45,6 +45,9 @@ if the year was not included in the dateformat (thanks to Michelle Crane). + Fixed bug #132, which failed to set a sort order so that active tasks sort higher than inactive tasks, all things being equal. + + Fixed bug #405, which incorrectly compared dates on tasks created by + versions earlier than 1.9.1 to those created by 1.9.1 or later (thanks to + Ivo Jimenez). ------ old releases ------------------------------ diff --git a/src/Att.cpp b/src/Att.cpp index 217a47157..5576919d8 100644 --- a/src/Att.cpp +++ b/src/Att.cpp @@ -492,8 +492,24 @@ bool Att::match (const Att& other) const // If there are no mods, just perform a straight compare on value. if (mMod == "") { - if (!compare (mValue, other.mValue, (bool) case_sensitive)) - return false; + // Exact matches on dates should only compare m/d/y, not h:m:s. This allows + // Comapisons like "task list due:today" (bug #405). + std::string which = type (mName); + if (which == "date") + { + Date left (mValue); + Date right (other.mValue); + + if (left.year () != right.year () || + left.month () != right.month () || + left.day () != right.day ()) + return false; + } + else + { + if (!compare (mValue, other.mValue, (bool) case_sensitive)) + return false; + } } // has = contains as a substring.