From 8e778712eaab8755f7777d1fd6adffdb26da9350 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 7 Nov 2015 17:12:25 -0500 Subject: [PATCH] TW-1313: some recurring intervals reset due time to midnight - Thanks to James Dietrich. --- AUTHORS | 1 + ChangeLog | 2 ++ src/recur.cpp | 22 ++++++++++++---------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/AUTHORS b/AUTHORS index d532a26df..21be9189a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -277,3 +277,4 @@ suggestions: Ander Naga Kiran David Badura + James Dietrich diff --git a/ChangeLog b/ChangeLog index e7519a961..af95b0d0d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ (thanks to Ben Boeckel). - TW-311 Estimated completion in burndown.daily shows impossible results (thanks to Michele Santullo). +- TW-1313 some recurring intervals reset due time to midnight + (thanks to James Dietrich). - TW-1446 Difference in how relative dates are specified in report filters since 2.3.0 (thanks to atomicules). - TW-1703 When on-modify hook is installed, some messages print UUIDs diff --git a/src/recur.cpp b/src/recur.cpp index cb038ddf0..54f813565 100644 --- a/src/recur.cpp +++ b/src/recur.cpp @@ -166,9 +166,8 @@ bool generateDueDates (Task& parent, std::vector & allDue) // Determine due date, recur period and until date. ISO8601d due (parent.get_date ("due")); if (due._date == 0) - { return false; - } + std::string recur = parent.get ("recur"); bool specificEnd = false; @@ -215,6 +214,9 @@ ISO8601d getNextRecurrence (ISO8601d& current, std::string& period) int m = current.month (); int d = current.day (); int y = current.year (); + int ho = current.hour (); + int mi = current.minute (); + int se = current.second (); // Some periods are difficult, because they can be vague. if (period == "monthly" || @@ -229,7 +231,7 @@ ISO8601d getNextRecurrence (ISO8601d& current, std::string& period) while (! ISO8601d::valid (m, d, y)) --d; - return ISO8601d (m, d, y); + return ISO8601d (m, d, y, ho, mi, se); } else if (period == "weekdays") @@ -259,7 +261,7 @@ ISO8601d getNextRecurrence (ISO8601d& current, std::string& period) while (! ISO8601d::valid (m, d, y)) --d; - return ISO8601d (m, d, y); + return ISO8601d (m, d, y, ho, mi, se); } else if (period[0] == 'P' && @@ -294,7 +296,7 @@ ISO8601d getNextRecurrence (ISO8601d& current, std::string& period) while (! ISO8601d::valid (m, d, y)) --d; - return ISO8601d (m, d, y); + return ISO8601d (m, d, y, ho, mi, se); } else if (Lexer::isDigit (period[0]) && period[period.length () - 1] == 'q') @@ -311,7 +313,7 @@ ISO8601d getNextRecurrence (ISO8601d& current, std::string& period) while (! ISO8601d::valid (m, d, y)) --d; - return ISO8601d (m, d, y); + return ISO8601d (m, d, y, ho, mi, se); } else if (period == "semiannual" || @@ -327,7 +329,7 @@ ISO8601d getNextRecurrence (ISO8601d& current, std::string& period) while (! ISO8601d::valid (m, d, y)) --d; - return ISO8601d (m, d, y); + return ISO8601d (m, d, y, ho, mi, se); } else if (period == "bimonthly" || @@ -343,7 +345,7 @@ ISO8601d getNextRecurrence (ISO8601d& current, std::string& period) while (! ISO8601d::valid (m, d, y)) --d; - return ISO8601d (m, d, y); + return ISO8601d (m, d, y, ho, mi, se); } else if (period == "biannual" || @@ -352,7 +354,7 @@ ISO8601d getNextRecurrence (ISO8601d& current, std::string& period) { y += 2; - return ISO8601d (m, d, y); + return ISO8601d (m, d, y, ho, mi, se); } else if (period == "annual" || @@ -366,7 +368,7 @@ ISO8601d getNextRecurrence (ISO8601d& current, std::string& period) if (m == 2 && d == 29) d = 28; - return ISO8601d (m, d, y); + return ISO8601d (m, d, y, ho, mi, se); } // Add the period to current, and we're done.