calfw capture: use format-time-string for day-of-week (Emacs 31 compat)
This commit is contained in:
@@ -1617,12 +1617,11 @@ Formats matching what org-caldav/ox-icalendar export correctly:
|
|||||||
- Timed single day: <2026-02-26 Thu 14:00-15:30>
|
- Timed single day: <2026-02-26 Thu 14:00-15:30>
|
||||||
- All-day multi: <2026-02-26 Thu>--<2026-02-28 Sat>
|
- All-day multi: <2026-02-26 Thu>--<2026-02-28 Sat>
|
||||||
- Timed multi-day: <2026-02-26 Thu 15:00>--<2026-02-28 Sat 22:00>"
|
- Timed multi-day: <2026-02-26 Thu 15:00>--<2026-02-28 Sat 22:00>"
|
||||||
(require 'calendar)
|
|
||||||
(let* ((date (or my/calfw-capture-date (calendar-current-date)))
|
(let* ((date (or my/calfw-capture-date (calendar-current-date)))
|
||||||
(m (nth 0 date))
|
(m (nth 0 date))
|
||||||
(d (nth 1 date))
|
(d (nth 1 date))
|
||||||
(y (nth 2 date))
|
(y (nth 2 date))
|
||||||
(dow (calendar-day-name date nil t))
|
(dow (format-time-string "%a" (encode-time 0 0 12 d m y)))
|
||||||
(start-time (read-string "Start time (HH:MM, empty=all-day): "))
|
(start-time (read-string "Start time (HH:MM, empty=all-day): "))
|
||||||
(end-input (unless (string-empty-p start-time)
|
(end-input (unless (string-empty-p start-time)
|
||||||
(read-string "End time or end date (HH:MM / YYYY-MM-DD / YYYY-MM-DD HH:MM, empty=same day open): "))))
|
(read-string "End time or end date (HH:MM / YYYY-MM-DD / YYYY-MM-DD HH:MM, empty=same day open): "))))
|
||||||
@@ -1634,7 +1633,7 @@ Formats matching what org-caldav/ox-icalendar export correctly:
|
|||||||
(format "<%04d-%02d-%02d %s>" y m d dow)
|
(format "<%04d-%02d-%02d %s>" y m d dow)
|
||||||
(let* ((parsed (parse-time-string (concat end-date " 00:00")))
|
(let* ((parsed (parse-time-string (concat end-date " 00:00")))
|
||||||
(ed (nth 3 parsed)) (em (nth 4 parsed)) (ey (nth 5 parsed))
|
(ed (nth 3 parsed)) (em (nth 4 parsed)) (ey (nth 5 parsed))
|
||||||
(edow (calendar-day-name (list em ed ey) nil t)))
|
(edow (format-time-string "%a" (encode-time 0 0 12 ed em ey))))
|
||||||
(format "<%04d-%02d-%02d %s>--<%04d-%02d-%02d %s>" y m d dow ey em ed edow)))))
|
(format "<%04d-%02d-%02d %s>--<%04d-%02d-%02d %s>" y m d dow ey em ed edow)))))
|
||||||
;; Timed event - check if end contains a date (multi-day)
|
;; Timed event - check if end contains a date (multi-day)
|
||||||
((and end-input (not (string-empty-p end-input))
|
((and end-input (not (string-empty-p end-input))
|
||||||
@@ -1645,7 +1644,7 @@ Formats matching what org-caldav/ox-icalendar export correctly:
|
|||||||
(end-date-part (substring end-input 0 10))
|
(end-date-part (substring end-input 0 10))
|
||||||
(parsed (parse-time-string (concat end-date-part " 00:00")))
|
(parsed (parse-time-string (concat end-date-part " 00:00")))
|
||||||
(ed (nth 3 parsed)) (em (nth 4 parsed)) (ey (nth 5 parsed))
|
(ed (nth 3 parsed)) (em (nth 4 parsed)) (ey (nth 5 parsed))
|
||||||
(edow (calendar-day-name (list em ed ey) nil t)))
|
(edow (format-time-string "%a" (encode-time 0 0 12 ed em ey))))
|
||||||
(if (string-empty-p end-time-part)
|
(if (string-empty-p end-time-part)
|
||||||
(format "<%04d-%02d-%02d %s %s>--<%04d-%02d-%02d %s>"
|
(format "<%04d-%02d-%02d %s %s>--<%04d-%02d-%02d %s>"
|
||||||
y m d dow start-time ey em ed edow)
|
y m d dow start-time ey em ed edow)
|
||||||
|
|||||||
Reference in New Issue
Block a user