From 398bc9c824629dc7661c08d5715fe5f6f71bd67e Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 26 May 2014 23:18:20 -0400 Subject: [PATCH] Task - If a date attribute is eval'ed and the result is a duration, add the value of 'now' to it, and store the result. So '2wks' as a due date is interpreted as 'now + 2ks'. --- src/Task.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Task.cpp b/src/Task.cpp index 0ff966f21..54725a818 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -2020,8 +2020,14 @@ void Task::modify (modType type) e.evaluateInfixExpression (value, v); context.debug (label + name + " <-- " + format ("{1}", v.get_date ()) + " <-- " + (std::string) v + " <-- " + value); - // TODO If v is duration and < 5y, add to now, else store as date. - // TODO Not sure if the above still holds true. + // If v is duration, add 'now' to it, else store as date. + if (v.type () == Variant::type_duration) + { + Variant now; + if (namedDates ("now", now)) + v += now; + } + set (name, v.get_date ()); ++modCount; }