Function: lunar-phase-list

lunar-phase-list is a byte-compiled function defined in lunar.el.gz.

Signature

(lunar-phase-list MONTH YEAR)

Documentation

List of lunar phases for three months starting with Gregorian MONTH, YEAR.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/lunar.el.gz
(defun lunar-phase-list (month year)
  "List of lunar phases for three months starting with Gregorian MONTH, YEAR."
  (let* ((index (lunar-index (list month 1 year)))
         (new-moon (lunar-phase index))
         (end-date (let ((end-month month)
                         (end-year year))
                     (calendar-increment-month end-month end-year 3)
                     (list (list end-month 1 end-year))))
         ;; Alternative for start-date:
;;;         (calendar-gregorian-from-absolute
;;;          (1- (calendar-absolute-from-gregorian (list month 1 year))))
         (start-date (progn
                       (calendar-increment-month month year -1)
                       (list (list month
                                   (calendar-last-day-of-month month year)
                                   year))))
         list)
    (while (calendar-date-compare new-moon end-date)
      (if (calendar-date-compare start-date new-moon)
          (setq list (append list (list new-moon))))
      (setq index (1+ index)
            new-moon (lunar-phase index)))
    list))