Function: icalendar-date/time-add-duration
icalendar-date/time-add-duration is a byte-compiled function defined
in icalendar-utils.el.gz.
Signature
(icalendar-date/time-add-duration START DURATION &optional VTIMEZONE)
Documentation
Return the end date(-time) which is a length of DURATION after START.
START should be an icalendar-date or icalendar-date-time; the
returned value will be of the same type as START. DURATION should be an
icalendar-dur-value. VTIMEZONE, if specified, should be the
icalendar-vtimezone representing the time zone of START.
Other relevant functions are documented in the icalendar group.
Shortdoc
;; icalendar
(icalendar-date/time-add-duration '(12 11 2024)
(make-decoded-time :day 4))
=> (12 15 2024)
(icalendar-date/time-add-duration '(0 0 10 11 12 2024 3 -1 nil)
(make-decoded-time :hour 2 :minute 30))
=> (0 30 12 11 12 2024 3 -1 nil)
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/icalendar-utils.el.gz
(defun ical:date/time-add-duration (start duration &optional vtimezone)
"Return the end date(-time) which is a length of DURATION after START.
START should be an `icalendar-date' or `icalendar-date-time'; the
returned value will be of the same type as START. DURATION should be an
`icalendar-dur-value'. VTIMEZONE, if specified, should be the
`icalendar-vtimezone' representing the time zone of START."
(if (integerp duration)
;; number of weeks:
(setq duration (make-decoded-time :day (* 7 duration))))
(cl-typecase start
(ical:date
(ical:date-time-to-date
(ical:date-time-add (ical:date-to-date-time start) duration)))
(ical:date-time
(ical:date-time-add start duration vtimezone))))