Function: icalendar-recur-find-interval

icalendar-recur-find-interval is a byte-compiled function defined in icalendar-recur.el.gz.

Signature

(icalendar-recur-find-interval TARGET DTSTART RRULE &optional VTIMEZONE)

Documentation

Return the recurrence interval around TARGET.

TARGET and DTSTART should be icalendar-date or icalendar-date-time values. RRULE should be an icalendar-recur.

The returned value is an interval [LOW HIGH NEXT-LOW] which represents the lower and upper bounds of a recurrence interval around TARGET. For some N, LOW is equal to START + N*INTERVALSIZE units, HIGH is equal to START + (N+1)*INTERVALSIZE units, and LOW <= TARGET < HIGH. START here is a time derived from DTSTART depending on RRULE's FREQ part: the first day of the year for a 'YEARLY rule, first day of the month for a 'MONTHLY rule, etc.

RRULE's interval determines INTERVALSIZE, and its frequency determines the units: a month for 'MONTHLY, etc.

If VTIMEZONE is provided, it is used to set time zone information in the returned interval bounds. Otherwise, the bounds contain no time zone information and represent floating local times.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/icalendar-recur.el.gz
(defun icr:find-interval (target dtstart rrule &optional vtimezone)
  "Return the recurrence interval around TARGET.

TARGET and DTSTART should be `icalendar-date' or `icalendar-date-time'
values.  RRULE should be an `icalendar-recur'.

The returned value is an interval [LOW HIGH NEXT-LOW] which
represents the lower and upper bounds of a recurrence interval around
TARGET.  For some N, LOW is equal to START + N*INTERVALSIZE units, HIGH
is equal to START + (N+1)*INTERVALSIZE units, and LOW <= TARGET < HIGH.
START here is a time derived from DTSTART depending on RRULE's
FREQ part: the first day of the year for a \\='YEARLY rule, first day
of the month for a \\='MONTHLY rule, etc.

RRULE's interval determines INTERVALSIZE, and its frequency
determines the units: a month for \\='MONTHLY, etc.

If VTIMEZONE is provided, it is used to set time zone information in the
returned interval bounds.  Otherwise, the bounds contain no time zone
information and represent floating local times."
  (let ((freq (ical:rrule-freq rrule))
        (intsize (ical:rrule-interval-size rrule))
        (weekstart (ical:rrule-weekstart rrule)))
    (cl-case freq
      (SECONDLY (icr:find-secondly-interval target dtstart intsize vtimezone))
      (MINUTELY (icr:find-minutely-interval target dtstart intsize vtimezone))
      (HOURLY (icr:find-hourly-interval target dtstart intsize vtimezone))
      (DAILY (icr:find-daily-interval target dtstart intsize vtimezone))
      (WEEKLY (icr:find-weekly-interval target dtstart intsize
                                        weekstart vtimezone))
      (MONTHLY (icr:find-monthly-interval target dtstart intsize vtimezone))
      (YEARLY (icr:find-yearly-interval target dtstart intsize vtimezone)))))