Function: calendar-bahai-nawruz-for-gregorian-year
calendar-bahai-nawruz-for-gregorian-year is a byte-compiled function
defined in cal-bahai.el.gz.
Signature
(calendar-bahai-nawruz-for-gregorian-year GREG-YEAR)
Documentation
Calculate Gregorian date of Naw-Rúz for Gregorian year GREG-YEAR.
Uses the vernal equinox as observed from Tehran to determine the date. The result is a Gregorian date (month day year). Bahá’í days run from sunset to sunset, so if the equinox occurs before sunset in Tehran, that day is Naw-Rúz; otherwise the next day is.
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/cal-bahai.el.gz
(defun calendar-bahai-nawruz-for-gregorian-year (greg-year)
"Calculate Gregorian date of Naw-Rúz for Gregorian year GREG-YEAR.
Uses the vernal equinox as observed from Tehran to determine the date.
The result is a Gregorian date (month day year).
Bahá’í days run from sunset to sunset, so if the equinox occurs before
sunset in Tehran, that day is Naw-Rúz; otherwise the next day is."
(let* ((calendar-latitude calendar-bahai-tehran-latitude)
(calendar-longitude calendar-bahai-tehran-longitude)
(calendar-time-zone calendar-bahai-tehran-timezone)
;; Disable DST for Tehran (Iran doesn't use DST anymore)
(calendar-daylight-savings-starts nil)
(calendar-daylight-savings-ends nil)
;; Get vernal equinox date and time (k=0 for spring equinox)
(equinox (solar-equinoxes/solstices 0 greg-year))
(eq-month (car equinox))
(eq-day-frac (cadr equinox))
(eq-day (floor eq-day-frac))
(eq-year (nth 2 equinox))
(eq-date (list eq-month eq-day eq-year))
;; Time of equinox in hours (fractional part of day * 24)
(eq-time (* 24 (- eq-day-frac eq-day)))
;; Get sunset time for this date in Tehran
;; solar-sunrise-sunset returns ((sunrise-time zone) (sunset-time zone) daylight)
(sunset-data (solar-sunrise-sunset eq-date))
(sunset-time (car (cadr sunset-data))) ; sunset time in hours
;; Tolerance in hours (2 minutes = 2/60 hours) to account for
;; minor differences in astronomical calculations vs official tables.
;; When the equinox is extremely close to sunset, small variations
;; in ephemeris data or refraction calculations can affect the result.
(tolerance (/ 2.0 60)))
;; If equinox occurs clearly before sunset (by more than the tolerance),
;; Naw-Rúz is that day. Otherwise, Naw-Rúz is the next day.
(if (and sunset-time (< eq-time (- sunset-time tolerance)))
eq-date
(calendar-gregorian-from-absolute
(1+ (calendar-absolute-from-gregorian eq-date))))))