[Timeline] Change time formats when displaying only one day

There is no use in displaying the whole date when it’s clear that we are only
looking at one day.  Thus, only hours and minutes are shown for start and end
times now.  To make the headline still useful, a new time format has been
introduced.
This commit is contained in:
Daniel - 2018-07-31 14:07:56 +02:00
parent 003051ab24
commit ddded41c7a
Signed by: dbo
GPG Key ID: 4F63DB96D45AA9C6
1 changed files with 11 additions and 3 deletions

View File

@ -35,9 +35,15 @@ Filter are applied in the order they are given in this list."
:group 'timeline-tools
:type '(list function))
(defcustom timeline-tools-headline-time-format
"%Y-%m-%d %H:%M"
"Format of time used in the headline of a timeline."
:group 'timeline-tools
:type 'string)
(defcustom timeline-tools-time-format
"%Y-%m-%d %H:%M"
"Format of time as used by the formatting functions."
"Format of time used inside a timeline"
:group 'timeline-tools
:type 'string)
@ -361,6 +367,8 @@ interactively, START and END are queried with `org-read-date."
(setq-local timeline-tools--current-time-end (org-time-string-to-seconds tend))
(setq-local timeline-tools--current-files files)
(setq-local timeline-tools--current-timeline timeline)
(setq-local timeline-tools-time-format timeline-tools-time-format)
(setq-local timeline-tools-headline-time-format timeline-tools-headline-time-format)
(hl-line-mode)
(buffer-enable-undo)
(timeline-tools-redraw-timeline))
@ -392,9 +400,9 @@ ending at 23:61. When not given, FILES defaults to
(let ((timeline timeline-tools--current-timeline))
(erase-buffer)
(insert (format "* Timeline from [%s] to [%s]\n\n"
(format-time-string timeline-tools-time-format
(format-time-string timeline-tools-headline-time-format
timeline-tools--current-time-start)
(format-time-string timeline-tools-time-format
(format-time-string timeline-tools-headline-time-format
timeline-tools--current-time-end)))
(insert "|--|\n")
(insert "| Category | Start | End | Duration | Task |\n")