mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 22:47:20 +02:00
Bug Fix - #206
- Fixed bug that prevented "task list start.after:1/1/2009" from working. Big, nasty bug.
This commit is contained in:
parent
e5f2b0c7d1
commit
e8fc210ab0
4 changed files with 119 additions and 4 deletions
21
src/Date.cpp
21
src/Date.cpp
|
@ -65,6 +65,10 @@ Date::Date (const std::string& mdy, const std::string& format /* = "m/d/Y" */)
|
|||
int day = 0;
|
||||
int year = 0;
|
||||
|
||||
// Perhaps it is an epoch date, in string form?
|
||||
if (isEpoch (mdy))
|
||||
return;
|
||||
|
||||
// Before parsing according to "format", perhaps this is a relative date?
|
||||
if (isRelativeDate (mdy))
|
||||
return;
|
||||
|
@ -83,8 +87,8 @@ Date::Date (const std::string& mdy, const std::string& format /* = "m/d/Y" */)
|
|||
throw std::string ("\"") + mdy + "\" is not a valid date.";
|
||||
}
|
||||
|
||||
if (i + 1 < mdy.length () &&
|
||||
(mdy[i + 0] == '0' || mdy[i + 0] == '1') &&
|
||||
if (i + 1 < mdy.length () &&
|
||||
(mdy[i + 0] == '0' || mdy[i + 0] == '1') &&
|
||||
::isdigit (mdy[i + 1]))
|
||||
{
|
||||
month = ::atoi (mdy.substr (i, 2).c_str ());
|
||||
|
@ -543,6 +547,19 @@ time_t Date::operator- (const Date& rhs)
|
|||
return mT - rhs.mT;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Date::isEpoch (const std::string& input)
|
||||
{
|
||||
if (digitsOnly (input) &&
|
||||
input.length () > 8)
|
||||
{
|
||||
mT = (time_t) ::atoi (input.c_str ());
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// If the input string looks like a relative date, determine that date, set mT
|
||||
// and return true.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue