From 2a74bc57afd19375edd1f34b471db88aa64b05de Mon Sep 17 00:00:00 2001 From: Patrick Winter Date: Thu, 7 Nov 2019 19:24:21 +0100 Subject: [PATCH] Change date format from YYYY-MM-DD to DD-MM-YYYY --- taskwarrior.el | 6 ++++-- test/taskwarrior-test.el | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) 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)