mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-24 18:06:42 +02:00
Feature #1039
- Added Feature #1039, which adds new date shortcuts, 'socm' and 'eocm', meaning start and end of current month (thanks to Thomas Sullivan, Louis-Claude Canon).
This commit is contained in:
parent
12b12c3a62
commit
4e03832b68
5 changed files with 54 additions and 36 deletions
10
src/Date.cpp
10
src/Date.cpp
|
@ -56,12 +56,14 @@ static const char* relatives[] =
|
|||
"eow",
|
||||
"eoww",
|
||||
"eocw",
|
||||
"eocm",
|
||||
"eom",
|
||||
"eoq",
|
||||
"eoy",
|
||||
"sow",
|
||||
"soww",
|
||||
"socw",
|
||||
"socm",
|
||||
"som",
|
||||
"soq",
|
||||
"soy",
|
||||
|
@ -828,7 +830,8 @@ bool Date::isRelativeDate (const std::string& input)
|
|||
found == "eocw" ||
|
||||
found == "sow" ||
|
||||
found == "soww" ||
|
||||
found == "socw")
|
||||
found == "socw" ||
|
||||
found == "socm")
|
||||
{
|
||||
if (found == "eow" || found == "eoww")
|
||||
dow = 5;
|
||||
|
@ -847,6 +850,9 @@ bool Date::isRelativeDate (const std::string& input)
|
|||
else
|
||||
today += (dow - today.dayOfWeek ()) * 86400;
|
||||
|
||||
if (found == "socm")
|
||||
today -= (today.day () - 1) * 86400;
|
||||
|
||||
int m, d, y;
|
||||
today.toMDY (m, d, y);
|
||||
Date then (m, d, y);
|
||||
|
@ -878,7 +884,7 @@ bool Date::isRelativeDate (const std::string& input)
|
|||
_t = then._t - 86400;
|
||||
return true;
|
||||
}
|
||||
else if (found == "eom")
|
||||
else if (found == "eom" || found == "eocm")
|
||||
{
|
||||
Date then (today.month (),
|
||||
daysInMonth (today.month (), today.year ()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue