diff --git a/ChangeLog b/ChangeLog index c4af04ab1..351e2e1c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -79,6 +79,8 @@ - TW-1636 UUID with numeric-only first segment is not parsed properly (thanks to Tomas Babej). - TW-1638 Undo doesn't work when a context is set (thanks to Jeremy John Reeder). +- TW-1640 '_get .start' for an inactive tasks returns a date formatted from + epoch 0. - Prevent potential task duplication during import for non-pending tasks. - Show the active context in "context list", if any is active. - Fix "task edit" dropping annotation text after newlines. diff --git a/src/DOM.cpp b/src/DOM.cpp index 17cb3c8d9..d726d6a0b 100644 --- a/src/DOM.cpp +++ b/src/DOM.cpp @@ -233,7 +233,13 @@ bool DOM::get (const std::string& name, const Task& task, Variant& value) } if (column->type () == "date") - value = Variant (task.get_date (canonical), Variant::type_date); + { + auto numeric = task.get_date (canonical); + if (numeric == 0) + value = Variant (""); + else + value = Variant (numeric, Variant::type_date); + } else if (column->type () == "duration" || canonical == "recur") value = Variant ((time_t) Duration (task.get (canonical)), Variant::type_duration); else if (column->type () == "numeric") @@ -306,10 +312,16 @@ bool DOM::get (const std::string& name, const Task& task, Variant& value) } if (column->type () == "date") - value = Variant (ref.get_date (canonical), Variant::type_date); + { + auto numeric = ref.get_date (canonical); + if (numeric == 0) + value = Variant (""); + else + value = Variant (numeric, Variant::type_date); + } else if (column->type () == "duration") { - std::string period = ref.get (canonical); + auto period = ref.get (canonical); context.debug ("ref.get(" + canonical + ") --> " + period); ISO8601p iso; diff --git a/test/dom.t b/test/dom.t index fd8b6c61b..1af3a9b66 100755 --- a/test/dom.t +++ b/test/dom.t @@ -190,6 +190,11 @@ class TestDOM(TestCase): code, out, err = self.t.runError("_get rc.missing") self.assertEqual(code, 1) + def test_dom_attribute_missing(self): + """DOM 1.end (missing)""" + code, out, err = self.t("_get 1.end") + self.assertEqual("\n", out) + if __name__ == "__main__": from simpletap import TAPTestRunner