Bug Fix - annual recurrence due-date creep

- Fixed bug where annual recurring tasks exhibit due-date creep
  (thanks to T. Charles Yun).
This commit is contained in:
Paul Beckingham
2009-04-12 00:05:21 -04:00
parent 1cbec205f1
commit daea320564
6 changed files with 100 additions and 0 deletions

View File

@@ -674,6 +674,19 @@ Date getNextRecurrence (Date& current, std::string& period)
return Date (m, d, y);
}
else if (period == "annual" ||
period == "yearly")
{
y += 1;
// If the due data just happens to be 2/29 in a leap year, then simply
// incrementing y is going to create an invalid date.
if (m == 2 && d == 29)
d = 28;
return Date (m, d, y);
}
// If the period is an 'easy' one, add it to current, and we're done.
int days = convertDuration (period);
return current + (days * 86400);