mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 13:37:20 +02:00
Enhancement - Date::operator-
- Implemented Date::operator-, to allow subtractions of Durations.
This commit is contained in:
parent
031c4c484d
commit
cb4fe4fffb
3 changed files with 10 additions and 2 deletions
|
@ -24,7 +24,6 @@
|
|||
// USA
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <time.h>
|
||||
|
@ -138,7 +137,7 @@ Date::Date (const std::string& input, const std::string& format /* = "m/d/Y" */)
|
|||
throw std::string ("\"") + input + "\" is not a valid date (d).";
|
||||
}
|
||||
|
||||
if (i + 1 < input.length () &&
|
||||
if (i + 1 < input.length () &&
|
||||
(input[i + 0] == '0' || input[i + 0] == '1' || input[i + 0] == '2' || input[i + 0] == '3') &&
|
||||
isdigit (input[i + 1]))
|
||||
{
|
||||
|
@ -808,6 +807,12 @@ bool Date::sameYear (const Date& rhs)
|
|||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Date Date::operator- (const int delta)
|
||||
{
|
||||
return Date (mT - delta);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Date Date::operator+ (const int delta)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue