From ef1e8892623cfe71c63df3db90611fd2f9ecde32 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Mon, 18 Jan 2021 02:20:13 -0500 Subject: [PATCH] ColTypeDate: Do not explicitly add now to relative dates Relative dates are now implicitly anchored around now datetime point during casting, hence there is no reason to do this anymore. --- src/columns/ColTypeDate.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/columns/ColTypeDate.cpp b/src/columns/ColTypeDate.cpp index e55e71fcf..1eb11d638 100644 --- a/src/columns/ColTypeDate.cpp +++ b/src/columns/ColTypeDate.cpp @@ -222,14 +222,13 @@ void ColumnTypeDate::modify (Task& task, const std::string& value) evaluatedValue = Variant (value); } - // If v is duration, add 'now' to it, else store as date. + // If v is duration, we need to convert it to date (and implicitly add now), + // else store as date. std::string label = " MODIFICATION "; if (evaluatedValue.type () == Variant::type_duration) { Context::getContext ().debug (label + _name + " <-- '" + format ("{1}", format (evaluatedValue.get_duration ())) + "' <-- '" + (std::string) evaluatedValue + "' <-- '" + value + '\''); - Datetime date_now; - Variant now (date_now.toEpoch (), Variant::type_date); - evaluatedValue += now; + evaluatedValue.cast (Variant::type_date); } else {