diff --git a/taskwarrior.el b/taskwarrior.el index 5618eb3..6a1894c 100644 --- a/taskwarrior.el +++ b/taskwarrior.el @@ -483,10 +483,12 @@ (minute (elt time 1)) (second (elt time 2))) (cond + ((eq timestamp nil) + nil) ((eq format :date) - (format "%s-%s-%s" day month year hour minute second)) + (format "%s-%s-%s" year month day hour minute second)) ((eq format :datetime) - (format "%s-%s-%s %s:%s:%s" day month year hour minute second))))) + (format "%s-%s-%s %s:%s:%s" year month day hour minute second))))) (provide 'taskwarrior) diff --git a/test/taskwarrior-test.el b/test/taskwarrior-test.el index 0043c5a..4fe9568 100644 --- a/test/taskwarrior-test.el +++ b/test/taskwarrior-test.el @@ -24,9 +24,9 @@ (should (string= (taskwarrior--parse-created-task-id "Some invalid input") nil))) (ert-deftest taskwarrior--parse-date () - (should (string= (taskwarrior--parse-date "20191108T225959Z") "08-11-2019")) - (should (string= (taskwarrior--parse-date "20191108T225959Z" :date) "08-11-2019")) - (should (string= (taskwarrior--parse-date "20191108T225959Z" :datetime) "08-11-2019 22:59:59"))) + (should (string= (taskwarrior--parse-date "20191108T225959Z") "2019-11-08")) + (should (string= (taskwarrior--parse-date "20191108T225959Z" :date) "2019-11-08")) + (should (string= (taskwarrior--parse-date "20191108T225959Z" :datetime) "2019-11-08 22:59:59"))) (provide 'taskwarrior-test)