Function: calendar-bahai-to-absolute

calendar-bahai-to-absolute is a byte-compiled function defined in cal-bahai.el.gz.

Signature

(calendar-bahai-to-absolute DATE)

Documentation

Compute absolute date from Bahá’í date DATE.

The absolute date is the number of days elapsed since the (imaginary) Gregorian date Sunday, December 31, 1 BC.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/cal-bahai.el.gz
(defun calendar-bahai-to-absolute (date)
  "Compute absolute date from Bahá’í date DATE.
The absolute date is the number of days elapsed since the (imaginary)
Gregorian date Sunday, December 31, 1 BC."
  (let* ((month (calendar-extract-month date))
         (day (calendar-extract-day date))
         (year (calendar-extract-year date))
         (prior-years (+ (1- year) 1844))
         (leap-days (- (+ (/ prior-years 4) ; leap days in prior years
                          (- (/ prior-years 100))
                          (/ prior-years 400))
                       calendar-bahai-leap-base)))
    (+ (1- calendar-bahai-epoch)        ; days before epoch
       (* 365 (1- year))                ; days in prior years
       leap-days
       (calendar-sum m 1 (< m month) 19)
       (if (= month 19)
           (if (calendar-bahai-leap-year-p year) 5 4)
         0)
       day)))                           ; days so far this month