emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* custom time format extension
@ 2020-07-29 20:16 Orm Finnendahl
  2020-07-30  7:25 ` Orm Finnendahl
  0 siblings, 1 reply; 2+ messages in thread
From: Orm Finnendahl @ 2020-07-29 20:16 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

 when exporting timestamps it always bothered me that timestamps with
start and end time on the same day got exported with a full date for
the start and end times separated by a dash.

After thinking about this for some time I implemented a method today,
which combines the advantage of being utmost flexible while
maintaining full backwards compatibility.

This is how it works: The cdr of org-time-stamp-custom-formats
normally contains a format string for formatting timestamps with
start/end time. When supplying a list of three strings instead of the
single format string to the cdr of org-time-stamp-custom-formats, the
first, second and third elements of that list are interpreted as
follows:

The first element is the full format in case start and end of the
timestamp are not on the same day. The second element of the list is
the format string for the start time of the timestamp. The third
element of the list is a format string for the end time of the
timestamp. (BTW: Supplying a list as second element of a dotted list
is equivalent to supplying a list with four strings to
org-time-stamp-custom-formats)

Below the mail is a short example for german date strings.

In case somebody is interested, I can provide the code off list. If
any of the maintainers is reading on this list and thinks it should
get revised and maybe adopted for orgmode, please let me know how to
issue pull requests for the code. I tried to be minimally invasive ;-)

--
Orm

-----------
Example:

(org-time-stamp-custom-formats '("%a %d.%m.%Y" . ("%a %d.%m.%Y %H:%M Uhr"
                                                  "%a %d.%m.%Y %H:%M"
                                                  "%H:%M Uhr")))

Formatting

<2020-11-21 Sa>  -> Sa 21.11.2020

<2020-11-21 Sa 10:00-18:00>  -> Sa 21.11.2020 10:00--18:00 Uhr


<2020-11-21 Sa 10:00>--<2020-11-22 So 18:00> -> Sa 21.11.2020 10:00 Uhr--So 22.11.2020 18:00 Uhr


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-30  7:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-29 20:16 custom time format extension Orm Finnendahl
2020-07-30  7:25 ` Orm Finnendahl

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).