[Org] Use ‘org-read-date’ to query dates for reporting

This commit is contained in:
Daniel - 2017-12-03 09:59:23 +01:00
parent 02a08afbe1
commit 096989ee33
Signed by: dbo
GPG Key ID: 4F63DB96D45AA9C6
1 changed files with 8 additions and 7 deletions

View File

@ -1060,7 +1060,8 @@ resulting list are sorted by START, ascending."
(defun db/org-format-timeline (tstart tend &optional files) (defun db/org-format-timeline (tstart tend &optional files)
"Display timeline of tasks in FILES between TSTART and TEND. "Display timeline of tasks in FILES between TSTART and TEND.
When not given, FILES defaults to `org-agenda-files." When not given, FILES defaults to `org-agenda-files."
(interactive "sStart: \nsEnd: ") (interactive (list (org-read-date nil nil nil "Start time: ")
(org-read-date nil nil nil "End time: ")))
(let ((timeline (db/org-timeline-in-range tstart tend files))) (let ((timeline (db/org-timeline-in-range tstart tend files)))
(let ((target-buffer (get-buffer-create " *Org Timeline*"))) (let ((target-buffer (get-buffer-create " *Org Timeline*")))
(with-current-buffer target-buffer (with-current-buffer target-buffer
@ -1094,12 +1095,12 @@ When not given, FILES defaults to `org-agenda-files."
(defun db/org-format-timeline-of-day (date &optional files) (defun db/org-format-timeline-of-day (date &optional files)
"Format timeline of given DATE. "Format timeline of given DATE.
DATE should be a string of the form %Y-%m-%d. The timeline will DATE should be a string of the form %Y-%m-%d. When called
be formatted for this day, starting at 00:00 and ending at 23:61. interactively, this date will be queried with `org-read-date.
When not given, FILES defaults to `org-agenda-files." The timeline will be formatted for this day, starting at 00:00
(interactive "sDate (default today): ") and ending at 23:61. When not given, FILES defaults to
(when (string-empty-p date) `org-agenda-files."
(setq date (format-time-string "%Y-%m-%d"))) (interactive (list (org-read-date nil nil)))
(db/org-format-timeline (concat date " 00:00") (db/org-format-timeline (concat date " 00:00")
(concat date " 23:61") (concat date " 23:61")
files)) files))