Function: calendar-hebrew-read-date

calendar-hebrew-read-date is a byte-compiled function defined in cal-hebrew.el.gz.

Signature

(calendar-hebrew-read-date)

Documentation

Interactively read the arguments for a Hebrew date command.

Reads a year, month, and day.

Source Code

;; Defined in /usr/src/emacs/lisp/calendar/cal-hebrew.el.gz
(defun calendar-hebrew-read-date ()
  "Interactively read the arguments for a Hebrew date command.
Reads a year, month, and day."
  (let* ((today (calendar-current-date))
         (year (calendar-read-sexp
                "Hebrew calendar year (>3760)"
                (lambda (x) (> x 3760))
                (calendar-extract-year
                 (calendar-hebrew-from-absolute
                  (calendar-absolute-from-gregorian today)))))
         (month-array (if (calendar-hebrew-leap-year-p year)
                          calendar-hebrew-month-name-array-leap-year
                        calendar-hebrew-month-name-array-common-year))
         (completion-ignore-case t)
         (month (cdr (assoc-string
                      (completing-read
                       "Hebrew calendar month name: "
                       (mapcar 'list (append month-array nil))
                       (if (= year 3761)
                           (lambda (x)
                             (let ((m (cdr
                                       (assoc-string
                                        (car x)
                                        (calendar-make-alist month-array)
                                        t))))
                               (< 0
                                  (calendar-hebrew-to-absolute
                                   (list m
                                         (calendar-hebrew-last-day-of-month
                                          m year)
                                         year))))))
                       t)
                      (calendar-make-alist month-array 1) t)))
         (last (calendar-hebrew-last-day-of-month month year))
         (first (if (and (= year 3761) (= month 10))
                    18 1))
         (day (calendar-read-sexp
               "Hebrew calendar day (%d-%d)"
               (lambda (x) (and (<= first x) (<= x last)))
               first
               first last)))
    (list (list month day year))))