mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 13:37:20 +02:00
Dates
+ Fixed bug with 'socm' date calculation that failed on some days, by simplifying the implementation.
This commit is contained in:
parent
b0bb56cfa8
commit
cfac0c42e8
2 changed files with 11 additions and 5 deletions
14
src/Date.cpp
14
src/Date.cpp
|
@ -830,8 +830,7 @@ bool Date::isRelativeDate (const std::string& input)
|
|||
found == "eocw" ||
|
||||
found == "sow" ||
|
||||
found == "soww" ||
|
||||
found == "socw" ||
|
||||
found == "socm")
|
||||
found == "socw")
|
||||
{
|
||||
if (found == "eow" || found == "eoww")
|
||||
dow = 5;
|
||||
|
@ -850,9 +849,6 @@ 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);
|
||||
|
@ -907,6 +903,14 @@ bool Date::isRelativeDate (const std::string& input)
|
|||
_t = then._t;
|
||||
return true;
|
||||
}
|
||||
else if (found == "socm")
|
||||
{
|
||||
int m = today.month ();
|
||||
int y = today.year ();
|
||||
Date then (m, 1, y);
|
||||
_t = then._t;
|
||||
return true;
|
||||
}
|
||||
else if (found == "som")
|
||||
{
|
||||
int m = today.month () + 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue