aboutsummaryrefslogtreecommitdiffstats
path: root/tekuti.el
diff options
context:
space:
mode:
authorGravatar Tom Willemse2021-06-24 21:09:22 -0700
committerGravatar Tom Willemse2021-06-24 21:09:22 -0700
commit0aee0a36313fcfe04f09b1ec891ad07d088c79b6 (patch)
tree46d8385fb0de59970d3a25c4b6afbb40657785de /tekuti.el
parent80ab0599af1046eb36c7d961f4a49bb494b5d14d (diff)
downloadtekuti-el-0aee0a36313fcfe04f09b1ec891ad07d088c79b6.tar.gz
tekuti-el-0aee0a36313fcfe04f09b1ec891ad07d088c79b6.zip
Move date conversion into a function
Diffstat (limited to 'tekuti.el')
-rw-r--r--tekuti.el20
1 files changed, 9 insertions, 11 deletions
diff --git a/tekuti.el b/tekuti.el
index 55a3f63..bf9a805 100644
--- a/tekuti.el
+++ b/tekuti.el
@@ -39,26 +39,24 @@
;;; Code:
+(defun tekuti--format-date (date)
+ "Format DATE into a date that tekuti understands."
+ (format-time-string "%a, %d %b %Y %H:%M:%S %Z"
+ (org-timestamp-to-time
+ (org-timestamp-from-string date))
+ t))
+
(defun tekuti-build-data-from-org ()
(append
(mapcar
(lambda (pair)
(pcase pair
(`("DATE" ,date)
- (list "DATE"
- (format-time-string
- "%a, %d %b %Y %H:%M:%S %Z"
- (org-timestamp-to-time
- (org-timestamp-from-string date))
- t)))
+ (list "DATE" (tekuti--format-date date)))
(`("COMMENTS_DATE" ,date)
(list "COMMENTS-CLOSED-DATE"
(and (not (string-empty-p date))
- (format-time-string
- "%a, %d %b %Y %H:%M:%S %Z"
- (org-timestamp-to-time
- (org-timestamp-from-string date))
- t))))
+ (tekuti--format-date date))))
(_ pair)))
(org-collect-keywords '("TITLE" "TAGS" "STATUS" "COMMENTS" "DATE" "COMMENTS_DATE")))
(list