Function: org-modern--timestamp
org-modern--timestamp is a natively compiled function defined in
org-modern.el.
Signature
(org-modern--timestamp)
Documentation
Prettify timestamps.
Source Code
;; Defined in /nix/store/0fwir9vccqq0yiqnswyf22ip3sl68f49-emacs-packages-deps/share/emacs/site-lisp/elpa/org-modern-20260722.1411/org-modern.el
(defun org-modern--timestamp ()
"Prettify timestamps."
(let* ((beg (1- (match-beginning 1)))
(end (match-end 0))
(tbeg (match-beginning 2))
(tend (match-end 2))
(active (eq (char-after beg) ?<))
(date-face (if active
'org-modern-date-active
'org-modern-date-inactive))
(time-face (if active
'org-modern-time-active
'org-modern-time-inactive)))
(remove-list-of-text-properties beg end '(display))
(if (consp org-modern-timestamp)
(let* ((time (save-match-data
(encode-time
(org-fix-decoded-time
(org-parse-time-string
(buffer-substring beg end))))))
(fmt org-modern-timestamp)
(date-str (format-time-string (car fmt) time))
(time-str (format-time-string (cdr fmt) time)))
;; year-month-day
(add-text-properties beg (if (eq tbeg tend) end tbeg)
`(face ,date-face display ,date-str))
;; hour:minute
(unless (eq tbeg tend)
(add-text-properties tbeg end
`(face ,time-face display ,time-str))))
(put-text-property beg (1+ beg) 'display " ")
(put-text-property (1- end) end 'display " ")
;; year-month-day
(put-text-property beg (if (eq tbeg tend) end tbeg) 'face date-face)
;; hour:minute
(unless (eq tbeg tend)
(put-text-property (1- tbeg) tbeg 'display
(string (char-before tbeg) ?\s))
(put-text-property tbeg end 'face time-face)))))