mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-30 22:43:24 +02:00
- Fixed bug that accepted a recurrence duration of '7' as '7secs' instead of the intended '7days'. It is now an error to omit the units. Thanks to Vlad Zhivotnev, Stanley G. - Modified unit tests to avoid a different error.
This commit is contained in:
parent
c4a61566af
commit
99b0c5568a
5 changed files with 27 additions and 16 deletions
|
@ -545,10 +545,9 @@ void Command::modify_task (
|
|||
long l = (long) strtod (result.c_str (), NULL);
|
||||
if (labs (l) < 5 * 365 * 86400)
|
||||
{
|
||||
Duration dur (result);
|
||||
Duration dur (value);
|
||||
Date now;
|
||||
now += l;
|
||||
//now += dur;
|
||||
task.set (name, now.toEpochString ());
|
||||
}
|
||||
else
|
||||
|
@ -562,7 +561,7 @@ void Command::modify_task (
|
|||
else if (name == "recur" ||
|
||||
column->type () == "duration")
|
||||
{
|
||||
// All values must be eval'd first.
|
||||
// All values must be eval'd first, in this case, just to catch errors.
|
||||
A3 value_tokens;
|
||||
value_tokens.capture (value);
|
||||
value_tokens = value_tokens.postfix (value_tokens.tokenize (value_tokens));
|
||||
|
@ -571,8 +570,11 @@ void Command::modify_task (
|
|||
std::string result = e.evalExpression (task);
|
||||
context.debug (std::string ("Eval '") + value + "' --> '" + result + "'");
|
||||
|
||||
Duration d (result);
|
||||
task.set (name, result);
|
||||
Duration d (value);
|
||||
|
||||
// Deliberately storing the 'raw' value, which is necessary for
|
||||
// durations like 'weekday'..
|
||||
task.set (name, value);
|
||||
}
|
||||
|
||||
// Need handling for numeric types, used by UDAs.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue