Function: diary-icalendar-format-date/time-as-local
diary-icalendar-format-date/time-as-local is a byte-compiled function
defined in diary-icalendar.el.gz.
Signature
(diary-icalendar-format-date/time-as-local DT &optional ORIGINAL-TZNAME)
Documentation
Format the icalendar-date or icalendar-date-time DT for the diary.
If DT is a plain date, only the date will be formatted. If DT is a date-time, both the date and the time will formatted, after translating DT into a date and time into the system local time.
If specified, ORIGINAL-TZNAME should be a string naming the time zone
observance in which DT was originally encoded in the iCalendar data. In
this case, the original clock time in DT will also be added in
parentheses, with date if necessary. For example:
2025/05/01 09:00 (08:00 GMT)
or
2025/05/01 18:00 (2025/05/02 08:00 JST)
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/diary-icalendar.el.gz
(defun di:format-date/time-as-local (dt &optional original-tzname)
"Format the `icalendar-date' or `icalendar-date-time' DT for the diary.
If DT is a plain date, only the date will be formatted. If DT is a
date-time, both the date and the time will formatted, after translating
DT into a date and time into the system local time.
If specified, ORIGINAL-TZNAME should be a string naming the time zone
observance in which DT was originally encoded in the iCalendar data. In
this case, the original clock time in DT will also be added in
parentheses, with date if necessary. For example:
2025/05/01 09:00 (08:00 GMT)
or
2025/05/01 18:00 (2025/05/02 08:00 JST)"
(let ((local-dt (ical:date/time-to-local dt)))
(cl-typecase local-dt
(ical:date (di:format-date local-dt))
(ical:date-time
(let ((date (di:format-date local-dt))
(time (di:format-time local-dt))
(orig-date (di:format-date dt))
(orig-time (di:format-time dt original-tzname)))
(if original-tzname
(format "%s %s (%s)" date time
(if (equal date orig-date)
orig-time
(format "%s %s" orig-date orig-time)))
(format "%s %s" date time)))))))