Merge branch '2.0.0' of tasktools.org:task into 2.0.0

This commit is contained in:
Paul Beckingham 2011-08-06 01:02:49 -04:00
commit 3e5bb713eb
5 changed files with 59 additions and 3 deletions

View file

@ -58,11 +58,13 @@ static const char* relatives[] =
"eoww",
"eocw",
"eom",
"eoq",
"eoy",
"sow",
"soww",
"socw",
"som",
"soq",
"soy",
"goodfriday",
"easter",
@ -877,6 +879,25 @@ bool Date::isRelativeDate (const std::string& input)
mT = then.mT;
return true;
}
else if (found == "eoq")
{
int m = today.month ();
int y = today.year ();
int q;
if (m <= 3)
q = 3;
else if (m >= 4 && m <= 6)
q = 6;
else if (m >= 7 && m <= 9)
q = 9;
else
q = 12;
Date then (q,
Date::daysInMonth (q, y),
y);
mT = then.mT;
return true;
}
else if (found == "eoy")
{
Date then (12, 31, today.year ());
@ -896,6 +917,25 @@ bool Date::isRelativeDate (const std::string& input)
mT = then.mT;
return true;
}
else if (found == "soq")
{
int m = today.month ();
int y = today.year ();
int q;
if (m <= 3)
q = 1;
else if (m >= 4 && m <= 6)
q = 4;
else if (m >= 7 && m <= 9)
q = 7;
else
q = 10;
Date then (q,
1,
y);
mT = then.mT;
return true;
}
else if (found == "soy")
{
Date then (1, 1, today.year () + 1);