diff --git a/src/Lexer.cpp b/src/Lexer.cpp index 27a3ab55d..8ce3d429c 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -130,7 +130,7 @@ bool Lexer::token (std::string& result, Type& type) space = _input.length (); std::string legacy = _input.substr (start, space - start); - Date legacyDate (legacy, Lexer::dateFormat, false, false); + Date legacyDate (legacy, Lexer::dateFormat, true, false); space -= start; while (space--) shift (); diff --git a/src/Task.cpp b/src/Task.cpp index 134d8cf99..5d3b05a75 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -1577,13 +1577,13 @@ void Task::validate (bool applyDefault /* = true */) { std::string value = get ("recur"); - ISO8601p p; + Duration d; std::string::size_type i = 0; - if (! p.parse (value, i)) + if (! d.parse (value, i)) { i = 0; - Duration d; - if (! d.parse (value, i)) + ISO8601p p; + if (! p.parse (value, i)) throw std::string (format (STRING_TASK_VALID_RECUR, value)); } } diff --git a/src/Variant.cpp b/src/Variant.cpp index 1bf082750..963a01c3f 100644 --- a/src/Variant.cpp +++ b/src/Variant.cpp @@ -1678,21 +1678,21 @@ void Variant::cast (const enum type new_type) case type_duration: { _duration = 0; - ISO8601p iso; + Duration dur; std::string::size_type pos = 0; - if (iso.parse (_string, pos) && + if (dur.parse (_string, pos) && pos == _string.length ()) { - _duration = (time_t) iso; + _duration = (time_t) dur; } else { - Duration dur; + ISO8601p iso; pos = 0; - if (dur.parse (_string, pos) && + if (iso.parse (_string, pos) && pos == _string.length ()) { - _duration = (time_t) dur; + _duration = (time_t) iso; } } }