Function: diary-hebrew-birthday

diary-hebrew-birthday is an autoloaded and byte-compiled function defined in cal-hebrew.el.gz.

Signature

(diary-hebrew-birthday MONTH DAY YEAR &optional AFTER-SUNSET)

Documentation

Hebrew birthday diary entry.

Entry applies if date is birthdate (MONTH DAY YEAR), or the day before. The order of the input parameters changes according to calendar-date-style (e.g. to DAY MONTH YEAR in the European style).

Assumes the associated diary entry is the name of the person.

Although the date of birth is specified by the *civil* calendar, this function determines the proper Hebrew calendar birthday. If the optional argument AFTER-SUNSET is non-nil, this means the birth occurred after local sunset on the given civil date. In this case, the following civil date corresponds to the Hebrew birthday.

Probably introduced at or before Emacs version 24.1.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/cal-hebrew.el.gz
;;;###diary-autoload
(defun diary-hebrew-birthday (month day year &optional after-sunset)
  "Hebrew birthday diary entry.
Entry applies if date is birthdate (MONTH DAY YEAR), or the day before.
The order of the input parameters changes according to
`calendar-date-style' (e.g. to DAY MONTH YEAR in the European style).

Assumes the associated diary entry is the name of the person.

Although the date of birth is specified by the *civil* calendar,
this function determines the proper Hebrew calendar birthday.
If the optional argument AFTER-SUNSET is non-nil, this means the
birth occurred after local sunset on the given civil date.
In this case, the following civil date corresponds to the Hebrew birthday."
  (let* ((h-date (calendar-hebrew-from-absolute
                  (+ (calendar-absolute-from-gregorian
                      (diary-make-date month day year))
                     (if after-sunset 1 0))))
         (h-year (calendar-extract-year h-date))     ; birth-day
         (d (calendar-absolute-from-gregorian date)) ; today
         (h-yr (calendar-extract-year (calendar-hebrew-from-absolute d)))
         (age (- h-yr h-year))          ; current H year - birth H-year
         (b-date (calendar-hebrew-birthday h-date h-yr)))
    (and (> age 0) (memq b-date (list d (1+ d)))
         (format "%s's %d%s Hebrew birthday%s" entry age
                 (diary-ordinal-suffix age)
                 (if (= b-date d) "" " (evening)")))))